From bb215e4a1fece603cdede556c1107135b31312a0 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 9 Sep 2013 05:26:52 -0500 Subject: Adjust patch to use dlist_pop() --- lib/llist.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/llist.c') diff --git a/lib/llist.c b/lib/llist.c index 596da40f..71a187db 100644 --- a/lib/llist.c +++ b/lib/llist.c @@ -37,8 +37,11 @@ void *dlist_pop(void *list) { struct double_list **pdlist = (struct double_list **)list, *dlist = *pdlist; - dlist->next->prev = dlist->prev; - dlist->prev->next = *pdlist = dlist->next; + if (dlist->next == dlist) *pdlist = 0; + else { + dlist->next->prev = dlist->prev; + dlist->prev->next = *pdlist = dlist->next; + } return dlist; } -- cgit v1.2.3