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@sixbynine.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Robert Bragg
2017-02-23 14:45:10 +00:00
parent e56550565e
commit a98ffe2477

View File

@@ -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); \