diff options
author | Matt Turner <mattst88@gmail.com> | 2014-06-25 10:51:30 -0700 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2014-07-01 08:55:51 -0700 |
commit | d6bb8bb7ce50dfec83e6be88fc21bb63315d516a (patch) | |
tree | 6e60593a9186998cc0820f15ac706936c7a2f527 /src/glsl/list.h | |
parent | 22cd9173295e2212e355db514bfc52138d03079d (diff) |
mesa: Add and use foreach_list_typed_safe.
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/glsl/list.h')
-rw-r--r-- | src/glsl/list.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/glsl/list.h b/src/glsl/list.h index 77e3aaf26e4..b7221cb7c7f 100644 --- a/src/glsl/list.h +++ b/src/glsl/list.h @@ -630,4 +630,13 @@ 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_safe(__type, __node, __field, __list) \ + for (__type * __node = \ + exec_node_data(__type, (__list)->head, __field), \ + * __next = \ + exec_node_data(__type, (__node)->__field.next, __field); \ + __next != NULL; \ + __node = __next, __next = \ + exec_node_data(__type, (__next)->__field.next, __field)) + #endif /* LIST_CONTAINER_H */ |