[Mesa-dev] [RFC 1/2] glsl/list: Add an iteration helper that starts after the given node

Jason Ekstrand jason at jlekstrand.net
Fri Sep 16 04:00:35 UTC 2016


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

diff --git a/src/compiler/glsl/list.h b/src/compiler/glsl/list.h
index b5b5b36..8371519 100644
--- a/src/compiler/glsl/list.h
+++ b/src/compiler/glsl/list.h
@@ -714,6 +714,15 @@ 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_after(__type, __node, __field, __after)    \
+   for (__type * __node =                                                  \
+           exec_node_data(__type, (__after)->__field.next, __field),       \
+               * __next =                                                  \
+           exec_node_data(__type, (__node)->__field.next, __field);        \
+        (__node)->__field.next != NULL;                                    \
+        __node = __next, __next =                                          \
+           exec_node_data(__type, (__next)->__field.next, __field))
+
 #define foreach_list_typed_reverse_safe(__type, __node, __field, __list)   \
    for (__type * __node =                                                  \
            exec_node_data(__type, (__list)->tail_sentinel.prev, __field),  \
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list