aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-09-09 05:26:52 -0500
committerRob Landley <rob@landley.net>2013-09-09 05:26:52 -0500
commitbb215e4a1fece603cdede556c1107135b31312a0 (patch)
tree61c4e038856cd84a3693df6a56a529202ec3f1f0 /lib
parent5f57bccc41c8893914121b00e16a96dd16282486 (diff)
downloadtoybox-bb215e4a1fece603cdede556c1107135b31312a0.tar.gz
Adjust patch to use dlist_pop()
Diffstat (limited to 'lib')
-rw-r--r--lib/llist.c7
1 files changed, 5 insertions, 2 deletions
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;
}