exec_list: add a list_foreach_typed_reverse() macro
authorConnor Abbott <connor.abbott@intel.com>
Tue, 22 Jul 2014 00:11:53 +0000 (17:11 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 15 Jan 2015 15:18:57 +0000 (07:18 -0800)
Reviewed-by: Eric Anholt <eric@anholt.net>
src/glsl/list.h

index 995c666ea5c159cb3e493820fe63370a414471d8..924c7296fa77ef99db07ecdb0ef72e855eb20e0f 100644 (file)
@@ -665,6 +665,12 @@ inline void exec_node::insert_before(exec_list *before)
        (__node)->__field.next != NULL;                                 \
        (__node) = exec_node_data(__type, (__node)->__field.next, __field))
 
+#define foreach_list_typed_reverse(__type, __node, __field, __list)        \
+   for (__type * __node =                                                \
+           exec_node_data(__type, (__list)->tail_pred, __field);        \
+        (__node)->__field.prev != NULL;                                 \
+        (__node) = exec_node_data(__type, (__node)->__field.prev, __field))
+
 #define foreach_list_typed_safe(__type, __node, __field, __list)           \
    for (__type * __node =                                                  \
            exec_node_data(__type, (__list)->head, __field),                \