summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-06-24 16:36:04 -0700
committerMatt Turner <[email protected]>2014-07-01 08:55:51 -0700
commit35976810405cedaf49151151d10c52e19636d684 (patch)
treec11d3a26aca3095ee21c2f2aea0ce76a6f2338b0 /src
parent4d6c9352f3b1d7c2df626b30bbfc6da4dfaf52e6 (diff)
glsl: Add typed foreach_in_list/_reverse macros.
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/list.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/glsl/list.h b/src/glsl/list.h
index 576bc14e44e..914ce962527 100644
--- a/src/glsl/list.h
+++ b/src/glsl/list.h
@@ -573,6 +573,16 @@ inline void exec_node::insert_before(exec_list *before)
; (__node)->next != NULL \
; (__node) = (__node)->next)
+#define foreach_in_list(__type, __inst, __list) \
+ for (__type *(__inst) = (__type *)(__list)->head; \
+ !(__inst)->is_tail_sentinel(); \
+ (__inst) = (__type *)(__inst)->next)
+
+#define foreach_in_list_reverse(__type, __inst, __list) \
+ for (__type *(__inst) = (__type *)(__list)->head; \
+ !(__inst)->is_head_sentinel(); \
+ (__inst) = (__type *)(__inst)->prev)
+
/**
* Iterate through two lists at once. Stops at the end of the shorter list.
*