From 9bf1522a945b8c9b3192fd62a06c344f8a5ddfc1 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 5 Nov 2004 23:22:12 +0000 Subject: [PATCH] Improve list_remove(). --- src/lib/kernel/list.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/kernel/list.c b/src/lib/kernel/list.c index 1227d6b..1735576 100644 --- a/src/lib/kernel/list.c +++ b/src/lib/kernel/list.c @@ -216,15 +216,15 @@ list_push_back (struct list *list, list_elem *elem) list_insert (list_end (list), elem); } -/* Removes ELEM from its list. Undefined behavior if ELEM is not - in a list. */ +/* Removes ELEM from its list and returns the element that + followed it. Undefined behavior if ELEM is not in a list. */ list_elem * list_remove (list_elem *elem) { ASSERT (is_interior (elem)); elem->prev->next = elem->next; elem->next->prev = elem->prev; - return elem; + return elem->next; } /* Removes the front element from LIST and returns it. -- 2.30.2