summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2014-11-07 18:26:50 -0800
committerJason Ekstrand <[email protected]>2015-01-15 07:19:01 -0800
commitc6582e884df3e052ec372ee7f8a8838f46681913 (patch)
treef554cf2dcb67ed181e1d4f465c4b66840276504a /src
parentdc4e660dfad86aa8cdd08a5ec8b9890095de7c07 (diff)
glsl/list: Add a foreach_list_typed_safe_reverse macro
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/list.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/glsl/list.h b/src/glsl/list.h
index 4774ccca218..330c17e378b 100644
--- a/src/glsl/list.h
+++ b/src/glsl/list.h
@@ -678,4 +678,13 @@ inline void exec_node::insert_before(exec_list *before)
__node = __next, __next = \
exec_node_data(__type, (__next)->__field.next, __field))
+#define foreach_list_typed_safe_reverse(__type, __node, __field, __list) \
+ for (__type * __node = \
+ exec_node_data(__type, (__list)->tail_pred, __field), \
+ * __prev = \
+ exec_node_data(__type, (__node)->__field.prev, __field); \
+ __prev != NULL; \
+ __node = __prev, __prev = \
+ exec_node_data(__type, (__prev)->__field.prev, __field))
+
#endif /* LIST_CONTAINER_H */