summaryrefslogtreecommitdiff
path: root/list.h
diff options
context:
space:
mode:
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 */