chiark / gitweb /
list: properly skip over first item in LIST_FOREACH_OTHERS
authorLennart Poettering <lennart@poettering.net>
Wed, 28 Jan 2015 13:03:31 +0000 (14:03 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 28 Jan 2015 13:04:23 +0000 (14:04 +0100)
src/shared/list.h

index 7ed6318..2939216 100644 (file)
                 (i) = (p);                                              \
                 while ((i) && (i)->name##_prev)                         \
                         (i) = (i)->name##_prev;                         \
+                if ((i) == (p))                                         \
+                        (i) = (p)->name##_next;                         \
              });                                                        \
              (i);                                                       \
              (i) = (i)->name##_next == (p) ? (p)->name##_next : (i)->name##_next)