diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-04-15 22:16:28 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-04-15 22:16:28 +0200 |
commit | 6dd0c4747aa57227b5898fc639e3f2b643ce013c (patch) | |
tree | e43ee077469b5c28fcf46dba51eb03e53214fad5 /lib/list.c | |
parent | 6ed576974dec969ad2745a451a6f680a3cdbcfc4 (diff) | |
download | dict-6dd0c4747aa57227b5898fc639e3f2b643ce013c.tar.gz dict-6dd0c4747aa57227b5898fc639e3f2b643ce013c.tar.bz2 dict-6dd0c4747aa57227b5898fc639e3f2b643ce013c.zip |
feat: Remove C implementation
Diffstat (limited to 'lib/list.c')
-rw-r--r-- | lib/list.c | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/lib/list.c b/lib/list.c deleted file mode 100644 index be1ac61..0000000 --- a/lib/list.c +++ /dev/null @@ -1,52 +0,0 @@ -#include "list.h" -#include <stdlib.h> - -LIST* list_add(LIST* list, void* item) -{ - - if (list == NULL) { - list = (LIST*)malloc(sizeof(LIST)); - list->size = 0; - list->list = (void**)malloc(sizeof(0)); - - } - - list->size ++; - void** new_list = (void**)reallocarray(list->list, list->size, sizeof(void*)); - - new_list[list->size-1] = item; - list->list = new_list; - - return list; - -} - -LIST* list_remove(LIST* list, unsigned int pos) -{ - for(unsigned int i = pos; i < list->size - 1; i++) - list->list[i] = list->list[i + 1]; - - list->size--; - - void** new_list = reallocarray(list->list, list->size, sizeof(void*)); - list->list = new_list; - - return list; -} - -void list_free(LIST* list) -{ - free(list->list); - free(list); -} - -void *list_get(LIST *list, unsigned int index) -{ - if (list == NULL) - return NULL; - - if (index < list->size) - return list->list[index]; - - return NULL; -} |