llist: add PA_LLIST_FOREACH_SAFE macro for iteration that allows deleting
authorLennart Poettering <lennart@poettering.net>
Wed, 26 Aug 2009 18:05:48 +0000 (20:05 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 26 Aug 2009 18:05:48 +0000 (20:05 +0200)
src/pulsecore/llist.h

index 58b51c6..27f174a 100644 (file)
 #define PA_LLIST_FOREACH(i,head)                                        \
     for (i = (head); i; i = i->next)
 
+#define PA_LLIST_FOREACH_SAFE(i,n,head)                                 \
+    for (i = (head); i && ((n = i->next), 1); i = n)
+
 #endif