comparison lib/llist.c @ 1059:ef72a16f4b3a draft

Redo tail closer to the original design. Add more tests for large data sets. (Still no -f support yet.)
author Rob Landley <rob@landley.net>
date Mon, 09 Sep 2013 04:26:03 -0500
parents 50d759f8b371
children c2663b7eca78
comparison
equal deleted inserted replaced
1058:de0ecfb36b7c 1059:ef72a16f4b3a
31 *llist = *next; 31 *llist = *next;
32 32
33 return (void *)next; 33 return (void *)next;
34 } 34 }
35 35
36 void *dlist_pop(void *list)
37 {
38 struct double_list **pdlist = (struct double_list **)list, *dlist = *pdlist;
39
40 dlist->next->prev = dlist->prev;
41 dlist->prev->next = *pdlist = dlist->next;
42
43 return dlist;
44 }
45
36 void dlist_add_nomalloc(struct double_list **list, struct double_list *new) 46 void dlist_add_nomalloc(struct double_list **list, struct double_list *new)
37 { 47 {
38 if (*list) { 48 if (*list) {
39 new->next = *list; 49 new->next = *list;
40 new->prev = (*list)->prev; 50 new->prev = (*list)->prev;