list: LIST_INSERT_BEFORE: update head if necessary (#4261)

If the new item is inserted before the first item in the list, then the
head must be updated as well.
Add a test to the list unit test to check for this.
This commit is contained in:
Michael Olbrich
2016-10-04 16:15:37 +02:00
committed by Zbigniew Jędrzejewski-Szmek
parent c080fbce9c
commit 5076f4219e
2 changed files with 25 additions and 0 deletions
+2
View File
@@ -142,6 +142,8 @@
} 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; \
} \