From 05498860e8f7b1e8bb27880bc7526de026694804 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Fri, 26 Mar 2021 21:55:50 +0100 Subject: Renamed libs Cleaner and more flexible. --- libs/libc/inc/list.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 libs/libc/inc/list.h (limited to 'libs/libc/inc/list.h') diff --git a/libs/libc/inc/list.h b/libs/libc/inc/list.h new file mode 100644 index 0000000..0b82b48 --- /dev/null +++ b/libs/libc/inc/list.h @@ -0,0 +1,29 @@ +// MIT License, Copyright (c) 2020 Marvin Borner + +#ifndef LIST_H +#define LIST_H + +#include + +struct list { + struct node *head; +}; + +struct node { + void *data; + int nonce; + struct node *next; + struct node *prev; +}; + +struct list *list_new(void); +void list_destroy(struct list *list); +/* struct node *list_new_node(); */ // TODO: Make node-specific things static/private? +/* void list_add_node(struct list *list, struct node *node); */ +struct node *list_add(struct list *list, void *data); +struct list *list_remove(struct list *list, struct node *node); +struct node *list_last(struct list *list); +struct list *list_swap(struct list *list, struct node *a, struct node *b); +struct node *list_first_data(struct list *list, void *data); + +#endif -- cgit v1.2.3