summaryrefslogtreecommitdiff
path: root/src/glsl
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2014-12-30 16:14:25 -0800
committerMatt Turner <mattst88@gmail.com>2015-01-23 17:57:39 -0800
commit579157e6c1a30fbe11af4b936c23f2e3a784c5da (patch)
treeb11d6e16d57772ef50d58af5e9378910320b96ae /src/glsl
parentc638ea3d19d46cfe65739af2c78373146ed50737 (diff)
glsl: Add a foreach_in_list_reverse_safe macro.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/list.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/glsl/list.h b/src/glsl/list.h
index 330c17e378b..85368a4e6c4 100644
--- a/src/glsl/list.h
+++ b/src/glsl/list.h
@@ -636,6 +636,12 @@ inline void exec_node::insert_before(exec_list *before)
__next != NULL; \
__node = __next, __next = (__type *)__next->next)
+#define foreach_in_list_reverse_safe(__type, __node, __list) \
+ for (__type *__node = (__type *)(__list)->tail_pred, \
+ *__prev = (__type *)__node->prev; \
+ __prev != NULL; \
+ __node = __prev, __prev = (__type *)__prev->prev)
+
#define foreach_in_list_use_after(__type, __inst, __list) \
__type *(__inst); \
for ((__inst) = (__type *)(__list)->head; \