comparison lib/llist.c @ 238:630b2e12db16

Move dlist_add() to lib/llist.c
author Rob Landley <rob@landley.net>
date Sun, 20 Jan 2008 17:34:53 -0600
parents 3981c96f9285
children aaac01796688
comparison
equal deleted inserted replaced
237:7cb15eae1664 238:630b2e12db16
28 void **next = (void **)*llist; 28 void **next = (void **)*llist;
29 *llist = *next; 29 *llist = *next;
30 30
31 return (void *)next; 31 return (void *)next;
32 } 32 }
33
34 // Add an entry to the end off a doubly linked list
35 void dlist_add(struct double_list **list, char *data)
36 {
37 struct double_list *line = xmalloc(sizeof(struct double_list));
38
39 line->data = data;
40 if (*list) {
41 line->next = *list;
42 line->prev = (*list)->prev;
43 (*list)->prev->next = line;
44 (*list)->prev = line;
45 } else *list = line->next = line->prev = line;
46 }