diff -r 3dc9075df822 -r eb9e7bd40a8e src/linked_list.c --- a/src/linked_list.c Sat Jan 29 14:32:04 2022 +0100 +++ b/src/linked_list.c Sun Jan 30 14:19:00 2022 +0100 @@ -463,7 +463,7 @@ #define CX_LL_LOC_DATA offsetof(cx_linked_list_node, payload) typedef struct { - cx_list_s base; + struct cx_list_s base; cx_linked_list_node *begin; cx_linked_list_node *end; } cx_linked_list; @@ -482,7 +482,7 @@ } static int cx_ll_insert_at( - cx_list_s *list, + struct cx_list_s *list, cx_linked_list_node *node, void const *elem ) { @@ -512,7 +512,7 @@ } static int cx_ll_insert( - cx_list_s *list, + struct cx_list_s *list, size_t index, void const *elem ) { @@ -527,14 +527,14 @@ } static int cx_ll_add( - cx_list_s *list, + struct cx_list_s *list, void const *elem ) { return cx_ll_insert(list, list->size, elem); } static int cx_pll_insert( - cx_list_s *list, + struct cx_list_s *list, size_t index, void const *elem ) { @@ -542,14 +542,14 @@ } static int cx_pll_add( - cx_list_s *list, + struct cx_list_s *list, void const *elem ) { return cx_ll_insert(list, list->size, &elem); } static int cx_ll_remove( - cx_list_s *list, + struct cx_list_s *list, size_t index ) { cx_linked_list *ll = (cx_linked_list *) list; @@ -572,7 +572,7 @@ } static void *cx_ll_at( - cx_list_s const *list, + struct cx_list_s const *list, size_t index ) { cx_linked_list *ll = (cx_linked_list *) list; @@ -581,7 +581,7 @@ } static void *cx_pll_at( - cx_list_s const *list, + struct cx_list_s const *list, size_t index ) { cx_linked_list *ll = (cx_linked_list *) list; @@ -590,7 +590,7 @@ } static size_t cx_ll_find( - cx_list_s const *list, + struct cx_list_s const *list, void const *elem ) { return cx_linked_list_find(((cx_linked_list *) list)->begin, @@ -599,7 +599,7 @@ } static size_t cx_pll_find( - cx_list_s const *list, + struct cx_list_s const *list, void const *elem ) { return cx_linked_list_find(((cx_linked_list *) list)->begin, @@ -607,28 +607,28 @@ true, list->cmpfunc, elem); } -static void cx_ll_sort(cx_list_s *list) { +static void cx_ll_sort(struct cx_list_s *list) { cx_linked_list *ll = (cx_linked_list *) list; cx_linked_list_sort((void **) &ll->begin, (void **) &ll->end, CX_LL_LOC_PREV, CX_LL_LOC_NEXT, CX_LL_LOC_DATA, false, list->cmpfunc); } -static void cx_pll_sort(cx_list_s *list) { +static void cx_pll_sort(struct cx_list_s *list) { cx_linked_list *ll = (cx_linked_list *) list; cx_linked_list_sort((void **) &ll->begin, (void **) &ll->end, CX_LL_LOC_PREV, CX_LL_LOC_NEXT, CX_LL_LOC_DATA, true, list->cmpfunc); } -static void cx_ll_reverse(cx_list_s *list) { +static void cx_ll_reverse(struct cx_list_s *list) { cx_linked_list *ll = (cx_linked_list *) list; cx_linked_list_reverse((void **) &ll->begin, (void **) ll->end, CX_LL_LOC_PREV, CX_LL_LOC_NEXT); } static int cx_ll_compare( - cx_list_s const *list, - cx_list_s const *other + struct cx_list_s const *list, + struct cx_list_s const *other ) { cx_linked_list *left = (cx_linked_list *) list; cx_linked_list *right = (cx_linked_list *) other; @@ -638,8 +638,8 @@ } static int cx_pll_compare( - cx_list_s const *list, - cx_list_s const *other + struct cx_list_s const *list, + struct cx_list_s const *other ) { cx_linked_list *left = (cx_linked_list *) list; cx_linked_list *right = (cx_linked_list *) other; @@ -680,7 +680,7 @@ } static CxIterator cx_ll_iterator( - cx_list_s *list, + struct cx_list_s *list, size_t index ) { CxIterator iter; @@ -695,7 +695,7 @@ } static CxIterator cx_pll_iterator( - cx_list_s *list, + struct cx_list_s *list, size_t index ) { CxIterator iter = cx_ll_iterator(list, index); @@ -708,7 +708,7 @@ void const *elem, int prepend ) { - cx_list_s *list = iter->src_handle; + struct cx_list_s *list = iter->src_handle; cx_linked_list_node *node = iter->elem_handle; if (node != NULL) { assert(prepend >= 0 && prepend <= 1); @@ -757,8 +757,8 @@ cx_pll_iterator, }; -CxList cxLinkedListCreate( - CxAllocator allocator, +CxList *cxLinkedListCreate( + CxAllocator *allocator, CxListComparator comparator, size_t item_size ) { @@ -776,11 +776,11 @@ list->begin = NULL; list->end = NULL; - return (CxList) list; + return (CxList *) list; } -CxList cxPointerLinkedListCreate( - CxAllocator allocator, +CxList *cxPointerLinkedListCreate( + CxAllocator *allocator, CxListComparator comparator ) { cx_linked_list *list = cxMalloc(allocator, sizeof(cx_linked_list)); @@ -797,17 +797,17 @@ list->begin = NULL; list->end = NULL; - return (CxList) list; + return (CxList *) list; } -CxList cxLinkedListFromArray( - CxAllocator allocator, +CxList *cxLinkedListFromArray( + CxAllocator *allocator, CxListComparator comparator, size_t item_size, size_t num_items, void const *array ) { - CxList list = cxLinkedListCreate(allocator, comparator, item_size); + CxList *list = cxLinkedListCreate(allocator, comparator, item_size); if (list == NULL) return NULL; for (size_t i = 0; i < num_items; i++) { if (0 != cxListAdd(list, ((const unsigned char *) array) + i * item_size)) { @@ -818,7 +818,7 @@ return list; } -void cxLinkedListDestroy(CxList list) { +void cxLinkedListDestroy(CxList *list) { cx_linked_list *ll = (cx_linked_list *) list; cx_linked_list_node *node = ll->begin;