summaryrefslogtreecommitdiffstats
path: root/lib/lists.h
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-08-03 21:31:30 +0200
committerMartin Mares <mj@ucw.cz>1999-08-03 21:31:30 +0200
commitb6628a8c98fa53c1b293221ad0f7e0611cb0b76d (patch)
tree7a7251f6db826f03ce8944b3cd9818961174cd78 /lib/lists.h
parent9a706f32afe703a44e605e92cc50cc77d4e91088 (diff)
downloadbird-b6628a8c98fa53c1b293221ad0f7e0611cb0b76d.tar
bird-b6628a8c98fa53c1b293221ad0f7e0611cb0b76d.zip
Added macros for walking lists backwards.
Diffstat (limited to 'lib/lists.h')
-rw-r--r--lib/lists.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/lists.h b/lib/lists.h
index 2d91ca5..acab292 100644
--- a/lib/lists.h
+++ b/lib/lists.h
@@ -24,6 +24,10 @@ typedef struct list { /* In fact two overlayed nodes */
n=(void *)((NODE (n))->next))
#define WALK_LIST_DELSAFE(n,nxt,list) \
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)