chiark / gitweb /
manager: always pull 'following' units into transaction
[elogind.git] / src / list.h
index 9380f362f1e1c7f1acf7f59640514b843fceca1f..2bec8c9e738f252332ca3b69b800bc21f704f461 100644 (file)
@@ -77,7 +77,7 @@
         do {                                                            \
                 t *_item = (item);                                      \
                 assert(_item);                                          \
-                while ((_item->name##_prev)                             \
+                while (_item->name##_prev)                              \
                        _item = _item->name##_prev;                      \
                 (head) = _item;                                         \
         } while (false)
                 }                                                       \
         } while(false)
 
+#define LIST_JUST_US(name,item)                                         \
+        (!(item)->name##_prev && !(item)->name##_next)                  \
+
 #define LIST_FOREACH(name,i,head)                                       \
         for ((i) = (head); (i); (i) = (i)->name##_next)
 
 #define LIST_FOREACH_SAFE(name,i,n,head)                                \
         for ((i) = (head); (i) && (((n) = (i)->name##_next), 1); (i) = (n))
 
+#define LIST_FOREACH_BEFORE(name,i,p)                                   \
+        for ((i) = (p)->name##_prev; (i); (i) = (i)->name##_prev)
+
+#define LIST_FOREACH_AFTER(name,i,p)                                    \
+        for ((i) = (p)->name##_next; (i); (i) = (i)->name##_next)
+
 #endif