[Mesa-dev] [PATCH RFC 03/11] glsl: add a foreach_list_reverse macro

Connor Abbott cwabbott0 at gmail.com
Wed Jan 22 09:16:50 PST 2014


---
 src/glsl/list.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/glsl/list.h b/src/glsl/list.h
index 694b686..2de20c3 100644
--- a/src/glsl/list.h
+++ b/src/glsl/list.h
@@ -383,6 +383,11 @@ inline void exec_node::insert_before(exec_list *before)
 	; (__node)->next != NULL 			\
 	; (__node) = (__node)->next)
 
+#define foreach_list_reverse(__node, __list)		\
+   for (exec_node * __node = (__list)->tail_pred	\
+	; (__node)->prev != NULL			\
+	; (__node) = (__node)->prev)
+
 /**
  * Iterate through two lists at once.  Stops at the end of the shorter list.
  *
-- 
1.8.3.1



More information about the mesa-dev mailing list