summaryrefslogtreecommitdiff
path: root/src/ll.c
diff options
context:
space:
mode:
author@syxhe <https://t.me/syxhe>2025-04-17 21:56:23 -0500
committer@syxhe <https://t.me/syxhe>2025-04-17 21:56:23 -0500
commitd47f45a5e3e40b48131409071b119b442c78bffc (patch)
tree95e95ac5cbf2be1fec5402452d586a3400d90a02 /src/ll.c
parent9bd10281119a28323ddd05bd13827bceb553cc56 (diff)
Create ll-internal files to maintain opaqueness of linked list while opening it up for reuse
Diffstat (limited to 'src/ll.c')
-rw-r--r--src/ll.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/src/ll.c b/src/ll.c
index d25818a..9bb1441 100644
--- a/src/ll.c
+++ b/src/ll.c
@@ -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
10typedef struct dll {
11 void *data;
12 dll_freecb freecb;
13
14 struct dll *next;
15 struct dll *prev;
16
17} dllnode;
18typedef struct dlinked {
19 int size;
20 dllnode *start;
21 dllnode *end;
22
23} dlinkedlist;
24
25
26dllnode * 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
36dlinkedlist * dlinkedlist_init(void) { 10dlinkedlist * 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;