1.1 --- a/src/linked_list.c Sat Jan 29 14:32:04 2022 +0100 1.2 +++ b/src/linked_list.c Sun Jan 30 14:19:00 2022 +0100 1.3 @@ -463,7 +463,7 @@ 1.4 #define CX_LL_LOC_DATA offsetof(cx_linked_list_node, payload) 1.5 1.6 typedef struct { 1.7 - cx_list_s base; 1.8 + struct cx_list_s base; 1.9 cx_linked_list_node *begin; 1.10 cx_linked_list_node *end; 1.11 } cx_linked_list; 1.12 @@ -482,7 +482,7 @@ 1.13 } 1.14 1.15 static int cx_ll_insert_at( 1.16 - cx_list_s *list, 1.17 + struct cx_list_s *list, 1.18 cx_linked_list_node *node, 1.19 void const *elem 1.20 ) { 1.21 @@ -512,7 +512,7 @@ 1.22 } 1.23 1.24 static int cx_ll_insert( 1.25 - cx_list_s *list, 1.26 + struct cx_list_s *list, 1.27 size_t index, 1.28 void const *elem 1.29 ) { 1.30 @@ -527,14 +527,14 @@ 1.31 } 1.32 1.33 static int cx_ll_add( 1.34 - cx_list_s *list, 1.35 + struct cx_list_s *list, 1.36 void const *elem 1.37 ) { 1.38 return cx_ll_insert(list, list->size, elem); 1.39 } 1.40 1.41 static int cx_pll_insert( 1.42 - cx_list_s *list, 1.43 + struct cx_list_s *list, 1.44 size_t index, 1.45 void const *elem 1.46 ) { 1.47 @@ -542,14 +542,14 @@ 1.48 } 1.49 1.50 static int cx_pll_add( 1.51 - cx_list_s *list, 1.52 + struct cx_list_s *list, 1.53 void const *elem 1.54 ) { 1.55 return cx_ll_insert(list, list->size, &elem); 1.56 } 1.57 1.58 static int cx_ll_remove( 1.59 - cx_list_s *list, 1.60 + struct cx_list_s *list, 1.61 size_t index 1.62 ) { 1.63 cx_linked_list *ll = (cx_linked_list *) list; 1.64 @@ -572,7 +572,7 @@ 1.65 } 1.66 1.67 static void *cx_ll_at( 1.68 - cx_list_s const *list, 1.69 + struct cx_list_s const *list, 1.70 size_t index 1.71 ) { 1.72 cx_linked_list *ll = (cx_linked_list *) list; 1.73 @@ -581,7 +581,7 @@ 1.74 } 1.75 1.76 static void *cx_pll_at( 1.77 - cx_list_s const *list, 1.78 + struct cx_list_s const *list, 1.79 size_t index 1.80 ) { 1.81 cx_linked_list *ll = (cx_linked_list *) list; 1.82 @@ -590,7 +590,7 @@ 1.83 } 1.84 1.85 static size_t cx_ll_find( 1.86 - cx_list_s const *list, 1.87 + struct cx_list_s const *list, 1.88 void const *elem 1.89 ) { 1.90 return cx_linked_list_find(((cx_linked_list *) list)->begin, 1.91 @@ -599,7 +599,7 @@ 1.92 } 1.93 1.94 static size_t cx_pll_find( 1.95 - cx_list_s const *list, 1.96 + struct cx_list_s const *list, 1.97 void const *elem 1.98 ) { 1.99 return cx_linked_list_find(((cx_linked_list *) list)->begin, 1.100 @@ -607,28 +607,28 @@ 1.101 true, list->cmpfunc, elem); 1.102 } 1.103 1.104 -static void cx_ll_sort(cx_list_s *list) { 1.105 +static void cx_ll_sort(struct cx_list_s *list) { 1.106 cx_linked_list *ll = (cx_linked_list *) list; 1.107 cx_linked_list_sort((void **) &ll->begin, (void **) &ll->end, 1.108 CX_LL_LOC_PREV, CX_LL_LOC_NEXT, CX_LL_LOC_DATA, 1.109 false, list->cmpfunc); 1.110 } 1.111 1.112 -static void cx_pll_sort(cx_list_s *list) { 1.113 +static void cx_pll_sort(struct cx_list_s *list) { 1.114 cx_linked_list *ll = (cx_linked_list *) list; 1.115 cx_linked_list_sort((void **) &ll->begin, (void **) &ll->end, 1.116 CX_LL_LOC_PREV, CX_LL_LOC_NEXT, CX_LL_LOC_DATA, 1.117 true, list->cmpfunc); 1.118 } 1.119 1.120 -static void cx_ll_reverse(cx_list_s *list) { 1.121 +static void cx_ll_reverse(struct cx_list_s *list) { 1.122 cx_linked_list *ll = (cx_linked_list *) list; 1.123 cx_linked_list_reverse((void **) &ll->begin, (void **) ll->end, CX_LL_LOC_PREV, CX_LL_LOC_NEXT); 1.124 } 1.125 1.126 static int cx_ll_compare( 1.127 - cx_list_s const *list, 1.128 - cx_list_s const *other 1.129 + struct cx_list_s const *list, 1.130 + struct cx_list_s const *other 1.131 ) { 1.132 cx_linked_list *left = (cx_linked_list *) list; 1.133 cx_linked_list *right = (cx_linked_list *) other; 1.134 @@ -638,8 +638,8 @@ 1.135 } 1.136 1.137 static int cx_pll_compare( 1.138 - cx_list_s const *list, 1.139 - cx_list_s const *other 1.140 + struct cx_list_s const *list, 1.141 + struct cx_list_s const *other 1.142 ) { 1.143 cx_linked_list *left = (cx_linked_list *) list; 1.144 cx_linked_list *right = (cx_linked_list *) other; 1.145 @@ -680,7 +680,7 @@ 1.146 } 1.147 1.148 static CxIterator cx_ll_iterator( 1.149 - cx_list_s *list, 1.150 + struct cx_list_s *list, 1.151 size_t index 1.152 ) { 1.153 CxIterator iter; 1.154 @@ -695,7 +695,7 @@ 1.155 } 1.156 1.157 static CxIterator cx_pll_iterator( 1.158 - cx_list_s *list, 1.159 + struct cx_list_s *list, 1.160 size_t index 1.161 ) { 1.162 CxIterator iter = cx_ll_iterator(list, index); 1.163 @@ -708,7 +708,7 @@ 1.164 void const *elem, 1.165 int prepend 1.166 ) { 1.167 - cx_list_s *list = iter->src_handle; 1.168 + struct cx_list_s *list = iter->src_handle; 1.169 cx_linked_list_node *node = iter->elem_handle; 1.170 if (node != NULL) { 1.171 assert(prepend >= 0 && prepend <= 1); 1.172 @@ -757,8 +757,8 @@ 1.173 cx_pll_iterator, 1.174 }; 1.175 1.176 -CxList cxLinkedListCreate( 1.177 - CxAllocator allocator, 1.178 +CxList *cxLinkedListCreate( 1.179 + CxAllocator *allocator, 1.180 CxListComparator comparator, 1.181 size_t item_size 1.182 ) { 1.183 @@ -776,11 +776,11 @@ 1.184 list->begin = NULL; 1.185 list->end = NULL; 1.186 1.187 - return (CxList) list; 1.188 + return (CxList *) list; 1.189 } 1.190 1.191 -CxList cxPointerLinkedListCreate( 1.192 - CxAllocator allocator, 1.193 +CxList *cxPointerLinkedListCreate( 1.194 + CxAllocator *allocator, 1.195 CxListComparator comparator 1.196 ) { 1.197 cx_linked_list *list = cxMalloc(allocator, sizeof(cx_linked_list)); 1.198 @@ -797,17 +797,17 @@ 1.199 list->begin = NULL; 1.200 list->end = NULL; 1.201 1.202 - return (CxList) list; 1.203 + return (CxList *) list; 1.204 } 1.205 1.206 -CxList cxLinkedListFromArray( 1.207 - CxAllocator allocator, 1.208 +CxList *cxLinkedListFromArray( 1.209 + CxAllocator *allocator, 1.210 CxListComparator comparator, 1.211 size_t item_size, 1.212 size_t num_items, 1.213 void const *array 1.214 ) { 1.215 - CxList list = cxLinkedListCreate(allocator, comparator, item_size); 1.216 + CxList *list = cxLinkedListCreate(allocator, comparator, item_size); 1.217 if (list == NULL) return NULL; 1.218 for (size_t i = 0; i < num_items; i++) { 1.219 if (0 != cxListAdd(list, ((const unsigned char *) array) + i * item_size)) { 1.220 @@ -818,7 +818,7 @@ 1.221 return list; 1.222 } 1.223 1.224 -void cxLinkedListDestroy(CxList list) { 1.225 +void cxLinkedListDestroy(CxList *list) { 1.226 cx_linked_list *ll = (cx_linked_list *) list; 1.227 1.228 cx_linked_list_node *node = ll->begin;