diff options
author | Rob Landley <rob@landley.net> | 2013-09-09 05:26:52 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2013-09-09 05:26:52 -0500 |
commit | bb215e4a1fece603cdede556c1107135b31312a0 (patch) | |
tree | 61c4e038856cd84a3693df6a56a529202ec3f1f0 /lib/llist.c | |
parent | 5f57bccc41c8893914121b00e16a96dd16282486 (diff) | |
download | toybox-bb215e4a1fece603cdede556c1107135b31312a0.tar.gz |
Adjust patch to use dlist_pop()
Diffstat (limited to 'lib/llist.c')
-rw-r--r-- | lib/llist.c | 7 |
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; } |