diff -r 9138acaa494b -r af6be1e123aa src/linked_list.c --- a/src/linked_list.c Tue Dec 28 17:24:18 2021 +0100 +++ b/src/linked_list.c Tue Dec 28 17:38:02 2021 +0100 @@ -57,19 +57,19 @@ } size_t cx_linked_list_find( - void *start, + void const *start, ptrdiff_t loc_advance, ptrdiff_t loc_data, bool follow_ptr, CxListComparator cmp_func, - void *elem + void const *elem ) { assert(start != NULL); assert(loc_advance >= 0); assert(loc_data >= 0); assert(cmp_func); - void *node = start; + void const *node = start; size_t index = 0; do { void *current = ll_data(node); @@ -268,7 +268,7 @@ } size_t cx_linked_list_size( - void *node, + void const *node, ptrdiff_t loc_next ) { assert(loc_next >= 0); @@ -397,14 +397,14 @@ } int cx_linked_list_compare( - void *begin_left, - void *begin_right, + void const *begin_left, + void const *begin_right, ptrdiff_t loc_advance, ptrdiff_t loc_data, bool follow_ptr, CxListComparator cmp_func ) { - void *left = begin_left, *right = begin_right; + void const *left = begin_left, *right = begin_right; while (left != NULL && right != NULL) { int result = cmp_func(ll_data(left), ll_data(right)); @@ -469,7 +469,7 @@ } cx_linked_list; static cx_linked_list_node *cx_ll_node_at( - cx_linked_list *list, + cx_linked_list const *list, size_t index ) { if (index >= list->base.size) { @@ -484,7 +484,7 @@ static int cx_ll_insert( cx_list_s *list, size_t index, - void *elem + void const *elem ) { // out-of bounds check if (index > list->size) return 1; @@ -520,7 +520,7 @@ static int cx_ll_add( cx_list_s *list, - void *elem + void const *elem ) { return cx_ll_insert(list, list->size, elem); } @@ -528,14 +528,14 @@ static int cx_pll_insert( cx_list_s *list, size_t index, - void *elem + void const *elem ) { return cx_ll_insert(list, index, &elem); } static int cx_pll_add( cx_list_s *list, - void *elem + void const *elem ) { return cx_ll_insert(list, list->size, &elem); } @@ -564,7 +564,7 @@ } static void *cx_ll_at( - cx_list_s *list, + cx_list_s const *list, size_t index ) { cx_linked_list *ll = (cx_linked_list *) list; @@ -573,7 +573,7 @@ } static void *cx_pll_at( - cx_list_s *list, + cx_list_s const *list, size_t index ) { cx_linked_list *ll = (cx_linked_list *) list; @@ -582,8 +582,8 @@ } static size_t cx_ll_find( - cx_list_s *list, - void *elem + cx_list_s const *list, + void const *elem ) { return cx_linked_list_find(((cx_linked_list *) list)->begin, CX_LL_LOC_NEXT, CX_LL_LOC_DATA, @@ -591,8 +591,8 @@ } static size_t cx_pll_find( - cx_list_s *list, - void *elem + cx_list_s const *list, + void const *elem ) { return cx_linked_list_find(((cx_linked_list *) list)->begin, CX_LL_LOC_NEXT, CX_LL_LOC_DATA, @@ -614,8 +614,8 @@ } static int cx_ll_compare( - cx_list_s *list, - cx_list_s *other + cx_list_s const *list, + cx_list_s const *other ) { cx_linked_list *left = (cx_linked_list *) list; cx_linked_list *right = (cx_linked_list *) other; @@ -625,8 +625,8 @@ } static int cx_pll_compare( - cx_list_s *list, - cx_list_s *other + cx_list_s const *list, + cx_list_s const *other ) { cx_linked_list *left = (cx_linked_list *) list; cx_linked_list *right = (cx_linked_list *) other; @@ -703,7 +703,7 @@ CxListComparator comparator, size_t item_size, size_t num_items, - const void *array + void const *array ) { CxList list = cxLinkedListCreate(allocator, comparator, item_size); if (list == NULL) return NULL;