Mesa (master): exec_list: Add a foreach_list_typed_from macro

Robert Bragg rib at kemper.freedesktop.org
Thu Mar 9 13:50:35 UTC 2017


Module: Mesa
Branch: master
Commit: a98ffe24772e041687ae1e5706951a7d630ee35b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a98ffe24772e041687ae1e5706951a7d630ee35b

Author: Robert Bragg <robert at sixbynine.org>
Date:   Thu Feb 23 14:45:10 2017 +0000

exec_list: Add a foreach_list_typed_from macro

This allows iterating list nodes from a given start point instead of
necessarily the list head.

Signed-off-by: Robert Bragg <robert at sixbynine.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Acked-by: Kenneth Graunke <kenneth at whitecape.org>

---

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

diff --git a/src/compiler/glsl/list.h b/src/compiler/glsl/list.h
index 6afb9dc..47f53b8 100644
--- a/src/compiler/glsl/list.h
+++ b/src/compiler/glsl/list.h
@@ -699,6 +699,11 @@ inline void exec_node::insert_before(exec_list *before)
 	(__node)->__field.next != NULL; 				\
 	(__node) = exec_node_data(__type, (__node)->__field.next, __field))
 
+#define foreach_list_typed_from(__type, __node, __field, __list, __start)  \
+   for (__type * __node = exec_node_data(__type, (__start), __field);      \
+	(__node)->__field.next != NULL;                                    \
+	(__node) = exec_node_data(__type, (__node)->__field.next, __field))
+
 #define foreach_list_typed_reverse(__type, __node, __field, __list)        \
    for (__type * __node =                                                \
            exec_node_data(__type, (__list)->tail_sentinel.prev, __field);  \




More information about the mesa-commit mailing list