Added macros for walking lists backwards.
This commit is contained in:
parent
9a706f32af
commit
b6628a8c98
1 changed files with 4 additions and 0 deletions
|
@ -24,6 +24,10 @@ typedef struct list { /* In fact two overlayed nodes */
|
||||||
n=(void *)((NODE (n))->next))
|
n=(void *)((NODE (n))->next))
|
||||||
#define WALK_LIST_DELSAFE(n,nxt,list) \
|
#define WALK_LIST_DELSAFE(n,nxt,list) \
|
||||||
for(n=HEAD(list); nxt=(void *)((NODE (n))->next); n=(void *) nxt)
|
for(n=HEAD(list); nxt=(void *)((NODE (n))->next); n=(void *) nxt)
|
||||||
|
#define WALK_LIST_BACKWARDS(n,list) for(n=TAIL(list);(NODE (n))->prev; \
|
||||||
|
n=(void *)((NODE (n))->prev))
|
||||||
|
#define WALK_LIST_BACKWARDS_DELSAFE(n,prv,list) \
|
||||||
|
for(n=TAIL(list); prv=(void *)((NODE (n))->prev); n=(void *) prv)
|
||||||
|
|
||||||
#define EMPTY_LIST(list) (!(list).head->next)
|
#define EMPTY_LIST(list) (!(list).head->next)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue