From 752c905b8ca694df1e863d500653b386653c35e7 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 10 May 2010 11:17:23 -0700 Subject: [PATCH] exec_list: Add simpler exec_list for-each macros --- list.h | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 */ -- 2.7.4