diff -r a10c3e127050 -r bb144d08cd44 src/linked_list.c --- a/src/linked_list.c Sun Oct 03 13:07:48 2021 +0200 +++ b/src/linked_list.c Sun Oct 03 14:06:57 2021 +0200 @@ -29,6 +29,7 @@ #include "cx/linked_list.h" #include #include +#include /* LOW LEVEL LINKED LIST FUNCTIONS */ @@ -61,16 +62,11 @@ } } -int cx_linked_list_add(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *new_node) { +void cx_linked_list_add(void **begin, void **end, ptrdiff_t loc_prev, ptrdiff_t loc_next, void *new_node) { void *last = cx_linked_list_last(begin, end, loc_next); if (last == NULL) { - if (begin == NULL) { - // no current list and no begin ptr to write to - we don't find something to append to - return 1; - } else { - // start fresh list - *begin = new_node; - } + assert(begin != NULL); + *begin = new_node; } else { // if there is a last node, update its next pointer void **next = CX_LL_PTR(last, loc_next); @@ -87,8 +83,6 @@ void **prev = CX_LL_PTR(new_node, loc_prev); *prev = last; } - - return 0; } /* HIGH LEVEL LINKED LIST IMPLEMENTATION */