From 6ef04efa853b80c76ead2d252b3f4771f4c25d5d Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 20 Jan 2008 17:34:53 -0600 Subject: Move dlist_add() to lib/llist.c --- lib/llist.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/llist.c') diff --git a/lib/llist.c b/lib/llist.c index 8d6fd265..4f9bc220 100644 --- a/lib/llist.c +++ b/lib/llist.c @@ -30,3 +30,17 @@ void *llist_pop(void *list) return (void *)next; } + +// Add an entry to the end off a doubly linked list +void dlist_add(struct double_list **list, char *data) +{ + struct double_list *line = xmalloc(sizeof(struct double_list)); + + line->data = data; + if (*list) { + line->next = *list; + line->prev = (*list)->prev; + (*list)->prev->next = line; + (*list)->prev = line; + } else *list = line->next = line->prev = line; +} -- cgit v1.2.3