Added plain dlist reverse forall.

Fri, 25 Mar 2005 17:48:19 +0100

author
Tuomo Valkonen <tuomov@iki.fi>
date
Fri, 25 Mar 2005 17:48:19 +0100
changeset 99
46ee75d9eba9
parent 98
147a593d3ceb
child 100
8ae0f0aa5a16

Added plain dlist reverse forall.

dlist.h file | annotate | diff | comparison | revisions
--- a/dlist.h	Sat Mar 19 22:07:55 2005 +0100
+++ b/dlist.h	Fri Mar 25 17:48:19 2005 +0100
@@ -100,11 +100,23 @@
 #define LIST_FOR_ALL(LIST, NODE, NEXT, PREV) \
     for(NODE=LIST; NODE!=NULL; NODE=(NODE)->NEXT)
 
+#define LIST_FOR_ALL_REV(LIST, NODE, NEXT, PREV)     \
+    for(NODE=((LIST)==NULL ? NULL : (LIST)->PREV);   \
+        NODE!=NULL;                                  \
+        NODE=((NODE)==(LIST) ? NULL : (NODE)->PREV))
+
 #define LIST_FOR_ALL_W_NEXT(LIST, NODE, NXT, NEXT, PREV)  \
     for(NODE=LL, NXT=(NODE==NULL ? NULL : (NODE)->NEXT);  \
         NODE!=NULL;                                       \
         NODE=NXT, NXT=(NODE==NULL ? NULL : (NODE)->NEXT))
 
+#define LIST_FOR_ALL_W_NEXT_REV(LIST, NODE, NXT, NEXT, PREV) \
+    for(NODE=((LIST)==NULL ? NULL : (LIST)->PREV),           \
+         NXT=((NODE)==(LIST) ? NULL : (NODE)->PREV);         \
+        NODE!=NULL;                                          \
+        NODE=NXT,                                            \
+         NXT=((NODE)==(LIST) ? NULL : (NODE)->PREV))
+
 
 /*}}}*/
 

mercurial