diff options
author | Martin Mares <mj@ucw.cz> | 1998-10-17 13:02:39 +0200 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 1998-10-17 13:02:39 +0200 |
commit | d92882be9b1bfcc1a8e8a7bd552bdec4831694aa (patch) | |
tree | 8287c67f63be3210947a9c37772dcab9479e3933 /lib | |
parent | c05ea56f8eb15dfe3c9d18496deaa926e0cf8aac (diff) | |
download | bird-d92882be9b1bfcc1a8e8a7bd552bdec4831694aa.tar bird-d92882be9b1bfcc1a8e8a7bd552bdec4831694aa.zip |
WALK_LIST_DELSAFE now actually works (it really couldn't since it didn't
reference list head at all).
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lists.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/lists.h b/lib/lists.h index 7fd697e..2d91ca5 100644 --- a/lib/lists.h +++ b/lib/lists.h @@ -20,12 +20,10 @@ 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(n=HEAD(list);(NODE (n))->next; \ n=(void *)((NODE (n))->next)) -#define WALK_LIST_DELSAFE(n,ne,list) \ - for( ne = (void *) (NODE n)->next; \ - ne; \ - ne = (void *) (NODE (n=ne))->next ) +#define WALK_LIST_DELSAFE(n,nxt,list) \ + for(n=HEAD(list); nxt=(void *)((NODE (n))->next); n=(void *) nxt) #define EMPTY_LIST(list) (!(list).head->next) |