summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--list.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/list.h b/list.h
index 2694174..3bfdf55 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 */