aboutsummaryrefslogtreecommitdiff
path: root/linked_list.h
diff options
context:
space:
mode:
Diffstat (limited to 'linked_list.h')
-rw-r--r--linked_list.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/linked_list.h b/linked_list.h
index 8c09d5e0..909a38a8 100644
--- a/linked_list.h
+++ b/linked_list.h
@@ -69,14 +69,20 @@ FMT_F(LLIST(TYPE));
/* Iterator */
+#define __PRE_LLIST(T, l, set) \
+ T* l; LINK(T)* __INTER(l);
+
+#define PRE_FOR_LLIST(T) __PRE_LLIST
+
// #define __BEG_LLIST(v, set) v = (set)->head
-#define __BEG_LLIST(l, set) l = FIRST(set)
-#define BEG_LLIST(T) LINK(T)* __BEG_LLIST
+#define __BEG_LLIST(T, l, set) __INTER(l) = FIRST(set), l = L(__INTER(l))
+#define BEG_LLIST(T) __BEG_LLIST
-#define __END_LLIST(l, set) l != (set)->tail
+#define __END_LLIST(T, l, set) __INTER(l) != (set)->tail
#define END_LLIST(T) __END_LLIST
-#define __NXT_LLIST(l, set) l = l->after
+#define __NXT_LLIST(T, l, set) __INTER(l) = __INTER(l)->after, l = L(__INTER(l))
+// #define __NXT_LLIST(T, l, set) l = L(__INTER(l) = __INTER(l)->after)
#define NXT_LLIST(T) __NXT_LLIST
#endif /* TYPE */