summaryrefslogtreecommitdiff
path: root/src/shared/list.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/list.h')
-rw-r--r--src/shared/list.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/shared/list.h b/src/shared/list.h
index 47f275a019..96d6237974 100644
--- a/src/shared/list.h
+++ b/src/shared/list.h
@@ -123,3 +123,10 @@
#define LIST_FOREACH_AFTER(name,i,p) \
for ((i) = (p)->name##_next; (i); (i) = (i)->name##_next)
+
+/* Loop starting from p->next until p->prev.
+ p can be adjusted meanwhile. */
+#define LIST_LOOP_BUT_ONE(name,i,head,p) \
+ for ((i) = (p)->name##_next ? (p)->name##_next : (head); \
+ (i) != (p); \
+ (i) = (i)->name##_next ? (i)->name##_next : (head))