diff options
author | Rob Landley <rob@landley.net> | 2014-05-29 05:22:02 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2014-05-29 05:22:02 -0500 |
commit | dc640259adff6007d195fd4cc78dcf9829e5e6ee (patch) | |
tree | 97ab6eb6abb286a3d612b8aa86646cf655b1a1cf /lib/llist.c | |
parent | 55e9f35223e40f455b80671f25b412072d9af678 (diff) | |
download | toybox-dc640259adff6007d195fd4cc78dcf9829e5e6ee.tar.gz |
Switch mtab_list to doubly linked so we can traverse in either order. Convert umount and df. Add dlist_terminate() to break lists for traversal in either direction.
Diffstat (limited to 'lib/llist.c')
-rw-r--r-- | lib/llist.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/llist.c b/lib/llist.c index 2d5bc97a..6b4b8f2c 100644 --- a/lib/llist.c +++ b/lib/llist.c @@ -85,3 +85,17 @@ struct double_list *dlist_add(struct double_list **list, char *data) return new; } + +// Terminate circular list for traversal in either direction. Returns end *. +void *dlist_terminate(void *list) +{ + struct double_list *end = list; + + if (!list) return 0; + + end = end->prev; + end->next->prev = 0; + end->next = 0; + + return end; +} |