summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libinput-util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libinput-util.c b/src/libinput-util.c
index 38594fa..eeeeca0 100644
--- a/src/libinput-util.c
+++ b/src/libinput-util.c
@@ -50,6 +50,9 @@ list_init(struct list *list)
void
list_insert(struct list *list, struct list *elm)
{
+ assert((list->next != NULL && list->prev != NULL) ||
+ !"list->next|prev is NULL, possibly missing list_init()");
+
elm->prev = list;
elm->next = list->next;
list->next = elm;
@@ -59,6 +62,9 @@ list_insert(struct list *list, struct list *elm)
void
list_remove(struct list *elm)
{
+ assert((elm->next != NULL && elm->prev != NULL) ||
+ !"list->next|prev is NULL, possibly missing list_init()");
+
elm->prev->next = elm->next;
elm->next->prev = elm->prev;
elm->next = NULL;
@@ -68,6 +74,9 @@ list_remove(struct list *elm)
bool
list_empty(const struct list *list)
{
+ assert((list->next != NULL && list->prev != NULL) ||
+ !"list->next|prev is NULL, possibly missing list_init()");
+
return list->next == list;
}