summaryrefslogtreecommitdiff
path: root/list.h
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-05-10 11:17:23 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-05-10 11:17:23 -0700
commit752c905b8ca694df1e863d500653b386653c35e7 (patch)
tree85cfbe62a3484077e2c9df35e5fc33cc586095d7 /list.h
parent43bfc2b6b5477b24d831f49a6ab2123ce95ba747 (diff)
exec_list: Add simpler exec_list for-each macros
Diffstat (limited to 'list.h')
-rw-r--r--list.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/list.h b/list.h
index 26941746b4..3bfdf55e2a 100644
--- a/list.h
+++ b/list.h
@@ -337,4 +337,14 @@ struct exec_list {
#endif
};
+#define foreach_list(__node, __list) \
+ for (exec_node * __node = (__list)->head \
+ ; (__node)->next != NULL \
+ ; (__node) = (__node)->next)
+
+#define foreach_list_const(__node, __list) \
+ for (const exec_node * __node = (__list)->head \
+ ; (__node)->next != NULL \
+ ; (__node) = (__node)->next)
+
#endif /* LIST_CONTAINER_H */