diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-02-17 11:41:23 +0100 |
---|---|---|
committer | gabrielgio <gabrielgio@workstation.lan> | 2024-02-17 16:48:54 +0100 |
commit | d102e028aee6571c0fd9dfd4074cfb3c15f4594e (patch) | |
tree | e0f3bdadc96019de0a7576ea591f8b304a962e67 /lib/list.h | |
parent | c573d3b7954296d95a0f8a79b8ac2ca261d86a02 (diff) | |
download | dict-d102e028aee6571c0fd9dfd4074cfb3c15f4594e.tar.gz dict-d102e028aee6571c0fd9dfd4074cfb3c15f4594e.tar.bz2 dict-d102e028aee6571c0fd9dfd4074cfb3c15f4594e.zip |
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
Diffstat (limited to 'lib/list.h')
-rw-r--r-- | lib/list.h | 29 |
1 files changed, 29 insertions, 0 deletions
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 <stdlib.h> + +#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); |