summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2024-01-21 10:33:31 +0100
committerSander Vrijders <sander@ouroboros.rocks>2024-01-31 10:27:56 +0100
commit396c311842ae7d138c13a6d054e1978d95af4c63 (patch)
tree52af4b3efb57f3b0bc6423fe8556c2f2dce01677 /src/lib
parent763d39ee64e95801ef972ceba74dd6c8c15b1ea7 (diff)
downloadouroboros-396c311842ae7d138c13a6d054e1978d95af4c63.tar.gz
ouroboros-396c311842ae7d138c13a6d054e1978d95af4c63.zip
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 <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/list.c2
1 files changed, 1 insertions, 1 deletions
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)