diff options
Diffstat (limited to 'src/ll.c')
| -rw-r--r-- | src/ll.c | 28 |
1 files changed, 1 insertions, 27 deletions
| @@ -1,38 +1,12 @@ | |||
| 1 | #include "ll.h" | 1 | #include "ll.h" |
| 2 | #include "ll-internal.h" | ||
| 2 | #include "shared.h" | 3 | #include "shared.h" |
| 3 | 4 | ||
| 4 | #include <asm-generic/errno-base.h> | ||
| 5 | #include <stddef.h> | 5 | #include <stddef.h> |
| 6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
| 7 | #include <errno.h> | 7 | #include <errno.h> |
| 8 | #include <error.h> | 8 | #include <error.h> |
| 9 | 9 | ||
| 10 | typedef struct dll { | ||
| 11 | void *data; | ||
| 12 | dll_freecb freecb; | ||
| 13 | |||
| 14 | struct dll *next; | ||
| 15 | struct dll *prev; | ||
| 16 | |||
| 17 | } dllnode; | ||
| 18 | typedef struct dlinked { | ||
| 19 | int size; | ||
| 20 | dllnode *start; | ||
| 21 | dllnode *end; | ||
| 22 | |||
| 23 | } dlinkedlist; | ||
| 24 | |||
| 25 | |||
| 26 | dllnode * dllnode_init(void *data, dll_freecb fcb) { | ||
| 27 | dllnode *n = xcalloc(1, sizeof(*n)); | ||
| 28 | n->data = data; | ||
| 29 | n->freecb = fcb; | ||
| 30 | n->prev = NULL; | ||
| 31 | n->next = NULL; | ||
| 32 | |||
| 33 | return n; | ||
| 34 | } | ||
| 35 | |||
| 36 | dlinkedlist * dlinkedlist_init(void) { | 10 | dlinkedlist * dlinkedlist_init(void) { |
| 37 | dlinkedlist *ll = xcalloc(1, sizeof(*ll)); | 11 | dlinkedlist *ll = xcalloc(1, sizeof(*ll)); |
| 38 | ll->end = NULL; | 12 | ll->end = NULL; |
