summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author@syxhe <https://t.me/syxhe>2025-06-06 13:42:25 -0500
committer@syxhe <https://t.me/syxhe>2025-06-06 13:42:25 -0500
commitec0cfdc492065dcce687797d3a931af105a461c8 (patch)
tree52aa3af71ef6a4ed600b9b7750827fd7521cf2d8 /src
parent16528ac295215e788cb226f0cc49f11f82919741 (diff)
Get rid of useless ll-internal files
Diffstat (limited to 'src')
-rw-r--r--src/ll-internal.c17
-rw-r--r--src/ll-internal.h28
-rw-r--r--src/ll.c30
-rwxr-xr-xsrc/main.c11
4 files changed, 28 insertions, 58 deletions
diff --git a/src/ll-internal.c b/src/ll-internal.c
deleted file mode 100644
index e56302e..0000000
--- a/src/ll-internal.c
+++ /dev/null
@@ -1,17 +0,0 @@
1#include "ll-internal.h"
2#include "shared.h"
3
4#include <stdlib.h>
5
6dllnode * dllnode_init(void *data, dll_freecb fcb) {
7 dllnode *n = VALLOC(1, sizeof(*n));
8 if(!n)
9 return NULL;
10
11 n->data = data;
12 n->freecb = fcb;
13 n->prev = NULL;
14 n->next = NULL;
15
16 return n;
17} \ No newline at end of file
diff --git a/src/ll-internal.h b/src/ll-internal.h
deleted file mode 100644
index e829669..0000000
--- a/src/ll-internal.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef __VXGG_REWRITE___LL_INTERNAL_H___21242172227746___
2#define __VXGG_REWRITE___LL_INTERNAL_H___21242172227746___
3
4#define __VXGG_REWRITE___LL_INTERNAL___ 1
5#include "ll.h"
6#undef __VXGG_REWRITE___LL_INTERNAL___
7
8typedef struct dll {
9 void *data;
10 dll_freecb freecb;
11
12 struct dll *next;
13 struct dll *prev;
14
15} dllnode;
16typedef struct dlinked {
17 int size;
18 dllnode *start;
19 dllnode *end;
20
21} dlinkedlist;
22
23dllnode * dllnode_init(void *data, dll_freecb fcb);
24
25// Note: This file exists because I want to reuse dlinkedlist's definitions from threadpool to create a concurrent queue without
26// sacrificing the opaqueness of the definition
27
28#endif \ No newline at end of file
diff --git a/src/ll.c b/src/ll.c
index 6cc2afe..b8d0d4c 100644
--- a/src/ll.c
+++ b/src/ll.c
@@ -1,12 +1,38 @@
1#include "ll.h" 1#include "ll.h"
2#include "ll-internal.h"
3#include "shared.h" 2#include "shared.h"
4 3
5#include <stddef.h>
6#include <stdlib.h> 4#include <stdlib.h>
7#include <errno.h> 5#include <errno.h>
8#include <error.h> 6#include <error.h>
9 7
8typedef struct dln {
9 void *data;
10 dll_freecb freecb;
11
12 struct dln *next;
13 struct dln *prev;
14
15} dllnode;
16typedef struct dlinked {
17 int size;
18 dllnode *start;
19 dllnode *end;
20
21} dlinkedlist;
22
23dllnode * dllnode_init(void *data, dll_freecb fcb) {
24 dllnode *n = VALLOC(1, sizeof(*n));
25 if(!n)
26 return NULL;
27
28 n->data = data;
29 n->freecb = fcb;
30 n->prev = NULL;
31 n->next = NULL;
32
33 return n;
34}
35
10dlinkedlist * dlinkedlist_init(void) { 36dlinkedlist * dlinkedlist_init(void) {
11 dlinkedlist *ll = VALLOC(1, sizeof(*ll)); 37 dlinkedlist *ll = VALLOC(1, sizeof(*ll));
12 if(!ll) 38 if(!ll)
diff --git a/src/main.c b/src/main.c
index 1e4f960..b0727e2 100755
--- a/src/main.c
+++ b/src/main.c
@@ -7,17 +7,6 @@
7 7
8#include <errno.h> 8#include <errno.h>
9#include <error.h> 9#include <error.h>
10#include <printf.h>
11#include <unistd.h>
12
13int testcb(void *arg) {
14 if(!arg)
15 return -1;
16
17 printf("%s\n", (char*)arg);
18
19 return 0;
20}
21 10
22int main() { 11int main() {
23 error(-1, ENOTSUP, "lol"); 12 error(-1, ENOTSUP, "lol");