Mesa (master): glsl: Add a foreach_in_list_reverse_safe macro.
Matt Turner
mattst88 at kemper.freedesktop.org
Sat Jan 24 01:56:21 UTC 2015
Module: Mesa
Branch: master
Commit: 579157e6c1a30fbe11af4b936c23f2e3a784c5da
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=579157e6c1a30fbe11af4b936c23f2e3a784c5da
Author: Matt Turner <mattst88 at gmail.com>
Date: Tue Dec 30 16:14:25 2014 -0800
glsl: Add a foreach_in_list_reverse_safe macro.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/glsl/list.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/glsl/list.h b/src/glsl/list.h
index 330c17e..85368a4 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; \
More information about the mesa-commit
mailing list