chiark / gitweb /
list: LIST_INSERT_BEFORE: update head if necessary (#4261)
[elogind.git] / src / basic / list.h
index 5962aa4..c3771a1 100644 (file)
                 } else {                                                \
                         if ((_b->name##_prev = _a->name##_prev))        \
                                 _b->name##_prev->name##_next = _b;      \
+                        else                                            \
+                                *_head = _b;                            \
                         _b->name##_next = _a;                           \
                         _a->name##_prev = _b;                           \
                 }                                                       \