mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-07 00:40:13 +01:00
util: add an extra assert for list_insert()
If we're adding an element that's not null or not a freshly initialized list, chances are we haven't removed it from a previous list. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
This commit is contained in:
parent
a06256d1c3
commit
28ef7456d3
1 changed files with 2 additions and 0 deletions
|
|
@ -52,6 +52,8 @@ list_insert(struct list *list, struct list *elm)
|
|||
{
|
||||
assert((list->next != NULL && list->prev != NULL) ||
|
||||
!"list->next|prev is NULL, possibly missing list_init()");
|
||||
assert(((elm->next == NULL && elm->prev == NULL) || list_empty(elm)) ||
|
||||
!"elm->next|prev is not NULL, list node used twice?");
|
||||
|
||||
elm->prev = list;
|
||||
elm->next = list->next;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue