From e1d2a837a04567526ab31e87e7369a2935cd08f0 Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Wed, 12 Jan 2005 19:27:35 +0000 Subject: [PATCH] Add LIST_FOR_EACH_SAFE - a list iteration macro that is safe against removal. --- include/wine/list.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/wine/list.h b/include/wine/list.h index 6d27fad623..558cb37140 100644 --- a/include/wine/list.h +++ b/include/wine/list.h @@ -143,6 +143,12 @@ inline static void list_init( struct list *list ) #define LIST_FOR_EACH(cursor,list) \ for ((cursor) = (list)->next; (cursor) != (list); (cursor) = (cursor)->next) +/* iterate through the list, with safety against removal */ +#define LIST_FOR_EACH_SAFE(cursor, cursor2, list) \ + for ((cursor) = (list)->next, (cursor2) = (cursor)->next; \ + (cursor) != (list); \ + (cursor) = (cursor2), (cursor2) = (cursor)->next) + /* macros for statically initialized lists */ #define LIST_INIT(list) { &(list), &(list) } -- 2.33.8