Commit 341ba0f6 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

Added a LIST_FOR_EACH_ENTRY_SAFE helper macro.

parent 8d1cf4eb
...@@ -155,6 +155,14 @@ inline static void list_init( struct list *list ) ...@@ -155,6 +155,14 @@ inline static void list_init( struct list *list )
&(elem)->field != (list); \ &(elem)->field != (list); \
(elem) = LIST_ENTRY((elem)->field.next, type, field)) (elem) = LIST_ENTRY((elem)->field.next, type, field))
/* iterate through the list using a list entry, with safety against removal */
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field) \
for ((cursor) = LIST_ENTRY((list)->next, type, field), \
(cursor2) = LIST_ENTRY((cursor)->field.next, type, field); \
&(cursor)->field != (list); \
(cursor) = (cursor2), \
(cursor2) = LIST_ENTRY((cursor)->field.next, type, field))
/* macros for statically initialized lists */ /* macros for statically initialized lists */
#define LIST_INIT(list) { &(list), &(list) } #define LIST_INIT(list) { &(list), &(list) }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment