From 396c311842ae7d138c13a6d054e1978d95af4c63 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 21 Jan 2024 10:33:31 +0100 Subject: lib: Make list empty on delete The list_del operation now lets nxt and prv point to the element itself, so that list_is_empty(e) is true after list_del(e). Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/list.c b/src/lib/list.c index 2d7f3b47..4fc9fa4a 100644 --- a/src/lib/list.c +++ b/src/lib/list.c @@ -62,7 +62,7 @@ void list_add_tail(struct list_head * n, void list_del(struct list_head * e) { del_list(e->prv, e->nxt); - e->nxt = e->prv = NULL; + e->nxt = e->prv = e; } bool list_is_empty(struct list_head * h) -- cgit v1.2.3