From d102e028aee6571c0fd9dfd4074cfb3c15f4594e Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sat, 17 Feb 2024 11:41:23 +0100 Subject: ref: Refactor newer folder structure Create a lib dict and importer project. * dict: holds the main application * importer: code to read from source to a common database. * lib: shared code --- lib/list.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 lib/list.h (limited to 'lib/list.h') diff --git a/lib/list.h b/lib/list.h new file mode 100644 index 0000000..dd28722 --- /dev/null +++ b/lib/list.h @@ -0,0 +1,29 @@ +#pragma once +#include + +#define LIST_SIZE_FACTOR 1.5 +struct list { + unsigned int size; + unsigned int allocated_size; + void** list; +}; + +typedef struct list LIST; + +/** +* Add an item to a list +* @list: array list structure. +* @item: item to be added to the list. +*/ +LIST* list_add(LIST* list, void* item); + +/** +* Remove an item from a given list +* @list: array list structure. +* @pos: position of item to be removed. +*/ +LIST *list_remove(LIST *list, unsigned int pos); + +void list_free(LIST* list); + +void *list_get(LIST *list, unsigned int index); -- cgit v1.2.3