From f540d4f3d3e6eeac98891da9326dfca6f472960a Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 13 Aug 2020 21:27:19 +0200 Subject: Added basic list lib --- lib/inc/list.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lib/inc/list.h (limited to 'lib/inc/list.h') diff --git a/lib/inc/list.h b/lib/inc/list.h new file mode 100644 index 0000000..5deaf59 --- /dev/null +++ b/lib/inc/list.h @@ -0,0 +1,25 @@ +// MIT License, Copyright (c) 2020 Marvin Borner + +#ifndef LIST_H +#define LIST_H + +#include <def.h> + +struct list { + struct node *head; +}; + +struct node { + void *data; + int nonce; + struct node *next; + struct node *prev; +}; + +struct list *list_new(); +/* struct node *list_new_node(); */ // TODO: Make node-specific things static/private? +/* void list_add_node(struct list *list, struct node *node); */ +void list_add(struct list *list, void *data); +void list_remove(struct list *list, struct node *node); + +#endif -- cgit v1.2.3