chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5d3c70e
)
list: LIST_INSERT_BEFORE: update head if necessary (#4261)
author
Michael Olbrich
<m.olbrich@pengutronix.de>
Tue, 4 Oct 2016 14:15:37 +0000
(16:15 +0200)
committer
Sven Eden
<yamakuzure@gmx.net>
Wed, 5 Jul 2017 06:50:54 +0000
(08:50 +0200)
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.
src/basic/list.h
patch
|
blob
|
history
diff --git
a/src/basic/list.h
b/src/basic/list.h
index 5962aa42113b5d425cd181241a7f17da9ef43439..c3771a177f70e494b94d868a62056bc5d8f6e6be 100644
(file)
--- 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; \
} \