Commit 28ef7456 authored by Peter Hutterer's avatar Peter Hutterer

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's avatarPeter Hutterer <>
Reviewed-by: Jonas Ådahl's avatarJonas Ådahl <>
parent a06256d1
......@@ -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;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment