From 6dd0c4747aa57227b5898fc639e3f2b643ce013c Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Mon, 15 Apr 2024 22:16:28 +0200 Subject: feat: Remove C implementation --- lib/list.c | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 lib/list.c (limited to 'lib/list.c') 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 - -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; -} -- cgit v1.2.3