diff -r 2842f729caab -r af766caea48d src/linked_list.c --- a/src/linked_list.c Sun Feb 14 11:31:13 2021 +0100 +++ b/src/linked_list.c Sun Feb 14 15:13:53 2021 +0100 @@ -156,30 +156,20 @@ }; CxList cxLinkedListCreate(CxAllocator allocator, CxListComparator comparator, size_t item_size) { - CxLinkedListDesc desc; - desc.item_size = item_size; - desc.begin = NULL; - desc.loc_prev = offsetof(struct cx_linked_list_node, prev); - desc.loc_next = offsetof(struct cx_linked_list_node, next); - - return cxLinkedListWrap(allocator, comparator, desc); -} - -CxList cxLinkedListWrap(CxAllocator allocator, CxListComparator comparator, CxLinkedListDesc desc) { - CxList list = cxMalloc(allocator, sizeof(list) + sizeof(cx_linked_list)); + CxList list = cxMalloc(allocator, sizeof(cx_list_s) + sizeof(cx_linked_list)); if (list == NULL) return NULL; list->cl = &cx_linked_list_class; list->data.allocator = allocator; list->data.cmpfunc = comparator; - list->data.itemsize = desc.item_size; + list->data.itemsize = item_size; list->data.capacity = SIZE_MAX; cx_linked_list *ll = (cx_linked_list *) list->data.listdata; - ll->begin = desc.begin; - ll->loc_prev = desc.loc_prev; - ll->loc_next = desc.loc_next; + ll->begin = NULL; + ll->loc_prev = offsetof(struct cx_linked_list_node, prev); + ll->loc_next = offsetof(struct cx_linked_list_node, next); cxLinkedListRecalculateSize(list); return list;