Lines Matching refs:list
1 /* llist.c - Linked list functions
3 * Linked list structures have a next pointer as their first element.
26 // Call a function (such as free()) on each element of a linked list.
27 void llist_traverse(void *list, void (*using)(void *node))
29 void *old = list;
31 while (list) {
32 void *pop = llist_pop(&list);
35 // End doubly linked list too.
36 if (old == list) break;
40 // Return the first item from the list, advancing the list (which must be called
41 // as &list)
42 void *llist_pop(void *list)
47 void **llist = (void **)list;
54 void *dlist_pop(void *list)
56 struct double_list **pdlist = (struct double_list **)list, *dlist = *pdlist;
67 void dlist_add_nomalloc(struct double_list **list, struct double_list *new)
69 if (*list) {
70 new->next = *list;
71 new->prev = (*list)->prev;
72 (*list)->prev->next = new;
73 (*list)->prev = new;
74 } else *list = new->next = new->prev = new;
78 // Add an entry to the end of a doubly linked list
79 struct double_list *dlist_add(struct double_list **list, char *data)
84 dlist_add_nomalloc(list, new);
89 // Terminate circular list for traversal in either direction. Returns end *.
90 void *dlist_terminate(void *list)
92 struct double_list *end = list;
94 if (!list) return 0;