From 70945cb645402a4bb1d3dc46a07928caeb954c1f Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Thu, 26 Jun 2014 11:58:57 +0200 Subject: Temporary integrated OSPF commit. --- lib/slists.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/slists.h') diff --git a/lib/slists.h b/lib/slists.h index 2334e36a..d98d02d2 100644 --- a/lib/slists.h +++ b/lib/slists.h @@ -68,10 +68,12 @@ typedef struct siterator { #define SNODE (snode *) #define SHEAD(list) ((void *)((list).head)) #define STAIL(list) ((void *)((list).tail)) -#define WALK_SLIST(n,list) for(n=SHEAD(list);(SNODE (n))->next; \ - n=(void *)((SNODE (n))->next)) +#define SNODE_NEXT(n) ((void *)((SNODE (n))->next)) +#define SNODE_VALID(n) ((SNODE (n))->next) + +#define WALK_SLIST(n,list) for(n=SHEAD(list); SNODE_VALID(n); n=SNODE_NEXT(n)) #define WALK_SLIST_DELSAFE(n,nxt,list) \ - for(n=SHEAD(list); nxt=(void *)((SNODE (n))->next); n=(void *) nxt) + for(n=SHEAD(list); nxt=SNODE_NEXT(n); n=(void *) nxt) #define EMPTY_SLIST(list) (!(list).head->next) void s_add_tail(slist *, snode *); -- cgit v1.2.3