]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Adding walk list which permits you to delete entries.
authorPavel Machek <pavel@ucw.cz>
Thu, 9 Jul 1998 19:35:23 +0000 (19:35 +0000)
committerPavel Machek <pavel@ucw.cz>
Thu, 9 Jul 1998 19:35:23 +0000 (19:35 +0000)
lib/lists.h

index 3230724f065d07c2a553cdeea36d675e06391ea9..ae02ad4334b0ae68172c908e37c2650abdf0a756 100644 (file)
@@ -20,8 +20,14 @@ typedef struct list {                        /* In fact two overlayed nodes */
 #define NODE (node *)
 #define HEAD(list) ((void *)((list).head))
 #define TAIL(list) ((void *)((list).tail))
-#define WALK_LIST(n,list) for((n)=HEAD(list);(NODE (n))->next; \
+#define WALK_LIST(n,list) for((NODE (n))=HEAD(list);(NODE (n))->next; \
                                n=(void *)((NODE (n))->next))
+#define WALK_LIST_DELSAFE(n,ne,list) \
+  if ( ((NODE n) = HEAD(list)) ) \
+    for( (NODE ne) = (NODE n)->next; \
+         ne; \
+         (NODE ne) = (NODE (n=ne))->next )
+
 #define EMPTY_LIST(list) (!(list).head->next)
 
 void add_tail(list *, node *);