diff options
author | Jon Santmyer <jon@jonsantmyer.com> | 2024-05-22 13:00:41 -0400 |
---|---|---|
committer | Jon Santmyer <jon@jonsantmyer.com> | 2024-05-22 13:00:41 -0400 |
commit | ace65b453151845bc361f21f3e5b651c35f9f126 (patch) | |
tree | 262ebd29b0ca1d8584f0b6f1efa7a00d9f4f3e43 /lib/linkedlist.c | |
parent | f004c1ade8d617a82cea2fe249434cccb47a2358 (diff) | |
download | jove-kernel-ace65b453151845bc361f21f3e5b651c35f9f126.tar.gz jove-kernel-ace65b453151845bc361f21f3e5b651c35f9f126.tar.bz2 jove-kernel-ace65b453151845bc361f21f3e5b651c35f9f126.zip |
Diffstat (limited to 'lib/linkedlist.c')
-rw-r--r-- | lib/linkedlist.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/lib/linkedlist.c b/lib/linkedlist.c deleted file mode 100644 index 6cc6403..0000000 --- a/lib/linkedlist.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "linkedlist.h" - -void -sll_new(struct SLinkedList *list, size_t obj_size) -{ - list->obj_size = obj_size; - list->count = 0; - list->head = list->tail = NULL; -}; - -void -sll_push(struct SLinkedList *list, void *data) -{ - struct SLLNode *node = (struct SLLNode*)data; - if(list->tail != NULL) { - list->tail->next = node; - } - if(list->head == NULL) - list->head = node; - list->tail = node; - list->count++; -} - -void* -sll_get(struct SLinkedList *list, size_t index) -{ - struct SLLNode *node = list->head; - if(node == NULL) return NULL; - if(index > list->count) return list->tail; - for(size_t i = 0; i < index; i++) { - node = node->next; - } - return node; -} |