1.1 --- a/src/linked_list.c Thu May 23 20:29:28 2024 +0200 1.2 +++ b/src/linked_list.c Thu May 23 20:31:37 2024 +0200 1.3 @@ -518,14 +518,14 @@ 1.4 1.5 // create the new new_node 1.6 cx_linked_list_node *new_node = cxMalloc(list->base.allocator, 1.7 - sizeof(cx_linked_list_node) + list->base.item_size); 1.8 + sizeof(cx_linked_list_node) + list->base.elem_size); 1.9 1.10 // sortir if failed 1.11 if (new_node == NULL) return 1; 1.12 1.13 // initialize new new_node 1.14 new_node->prev = new_node->next = NULL; 1.15 - memcpy(new_node->payload, elem, list->base.item_size); 1.16 + memcpy(new_node->payload, elem, list->base.elem_size); 1.17 1.18 // insert 1.19 cx_linked_list *ll = (cx_linked_list *) list; 1.20 @@ -566,7 +566,7 @@ 1.21 // we can add the remaining nodes and immedately advance to the inserted node 1.22 char const *source = array; 1.23 for (size_t i = 1; i < n; i++) { 1.24 - source += list->base.item_size; 1.25 + source += list->base.elem_size; 1.26 if (0 != cx_ll_insert_at(list, node, source)) { 1.27 return i; 1.28 } 1.29 @@ -707,7 +707,7 @@ 1.30 } 1.31 } 1.32 1.33 - if (list->base.item_size > CX_LINKED_LIST_SWAP_SBO_SIZE) { 1.34 + if (list->base.elem_size > CX_LINKED_LIST_SWAP_SBO_SIZE) { 1.35 cx_linked_list_node *prev = nleft->prev; 1.36 cx_linked_list_node *next = nright->next; 1.37 cx_linked_list_node *midstart = nleft->next; 1.38 @@ -739,9 +739,9 @@ 1.39 } else { 1.40 // swap payloads to avoid relinking 1.41 char buf[CX_LINKED_LIST_SWAP_SBO_SIZE]; 1.42 - memcpy(buf, nleft->payload, list->base.item_size); 1.43 - memcpy(nleft->payload, nright->payload, list->base.item_size); 1.44 - memcpy(nright->payload, buf, list->base.item_size); 1.45 + memcpy(buf, nleft->payload, list->base.elem_size); 1.46 + memcpy(nleft->payload, nright->payload, list->base.elem_size); 1.47 + memcpy(nright->payload, buf, list->base.elem_size); 1.48 } 1.49 1.50 return 0; 1.51 @@ -871,7 +871,7 @@ 1.52 iter.index = index; 1.53 iter.src_handle.c = list; 1.54 iter.elem_handle = cx_ll_node_at((cx_linked_list const *) list, index); 1.55 - iter.elem_size = list->base.item_size; 1.56 + iter.elem_size = list->base.elem_size; 1.57 iter.elem_count = list->base.size; 1.58 iter.base.valid = cx_ll_iter_valid; 1.59 iter.base.current = cx_ll_iter_current; 1.60 @@ -934,7 +934,7 @@ 1.61 CxList *cxLinkedListCreate( 1.62 CxAllocator const *allocator, 1.63 cx_compare_func comparator, 1.64 - size_t item_size 1.65 + size_t elem_size 1.66 ) { 1.67 if (allocator == NULL) { 1.68 allocator = cxDefaultAllocator; 1.69 @@ -946,8 +946,8 @@ 1.70 list->base.cl = &cx_linked_list_class; 1.71 list->base.base.allocator = allocator; 1.72 1.73 - if (item_size > 0) { 1.74 - list->base.base.item_size = item_size; 1.75 + if (elem_size > 0) { 1.76 + list->base.base.elem_size = elem_size; 1.77 list->base.base.cmpfunc = comparator; 1.78 } else { 1.79 list->base.base.cmpfunc = comparator == NULL ? cx_cmp_ptr : comparator;