diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2016-10-04 16:15:37 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-10-04 16:15:37 +0200 |
commit | 5076f4219ee3f25a39e3520943270c2c915b03d1 (patch) | |
tree | 62dd523177ad99e013bfa407bf56584dd915607b /src/basic/list.h | |
parent | c080fbce9ca4ac21d8dbb1c2d0e8c9205edfdbfb (diff) |
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.
Diffstat (limited to 'src/basic/list.h')
-rw-r--r-- | src/basic/list.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/basic/list.h b/src/basic/list.h index 5962aa4211..c3771a177f 100644 --- a/src/basic/list.h +++ b/src/basic/list.h @@ -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; \ } \ |