summaryrefslogtreecommitdiffstats
path: root/list.h
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2024-05-03 22:30:34 -0400
committerMalfurious <m@lfurio.us>2024-05-08 05:57:59 -0400
commitb67c753ac8bed628b5596ff71909708500d432a2 (patch)
tree232b181a6d404023da5083cfaab4d63e03336217 /list.h
parentac95555111931d77b46ca6ad9fff51ae7db61be9 (diff)
downloadmisplays-b67c753ac8bed628b5596ff71909708500d432a2.tar.gz
misplays-b67c753ac8bed628b5596ff71909708500d432a2.zip
Add additional list operations
Add list functions which can efficiently cut down on some bolierplate. The rest of the code will eventually be cleaned to make use of them. Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'list.h')
-rw-r--r--list.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/list.h b/list.h
index 7d7a272..2bfa1e1 100644
--- a/list.h
+++ b/list.h
@@ -1,10 +1,16 @@
#pragma once
-#define LINKEDLIST void *prev, *next
+#define LINKEDLIST void *prev, *next, *listhead
struct list {
void *tail, *head, *end;
};
extern void list_init(struct list *list);
+extern int list_empty(struct list *list);
+extern int list_singleton(struct list *list);
+
+extern void *list_circular_prev(void *_node);
+extern void *list_circular_next(void *_node);
+
extern void list_insert(void *_next, void *_node);
extern void list_remove(void *_node);