From: Ian Romanick Date: Mon, 10 May 2010 18:17:23 +0000 (-0700) Subject: exec_list: Add simpler exec_list for-each macros X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=752c905b8ca694df1e863d500653b386653c35e7;p=mesa.git exec_list: Add simpler exec_list for-each macros --- diff --git a/list.h b/list.h index 26941746b45..3bfdf55e2a2 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 */