src/linked_list.c

changeset 1111
78eeeb950883
parent 1065
6eb7b54975ee
child 1113
dce04550fbef
--- a/src/linked_list.c	Sun Jan 05 18:19:42 2025 +0100
+++ b/src/linked_list.c	Mon Jan 06 23:29:41 2025 +0100
@@ -1138,17 +1138,8 @@
 
     cx_linked_list *list = cxCalloc(allocator, 1, sizeof(cx_linked_list));
     if (list == NULL) return NULL;
-
-    list->base.cl = &cx_linked_list_class;
-    list->base.collection.allocator = allocator;
-
-    if (elem_size > 0) {
-        list->base.collection.elem_size = elem_size;
-        list->base.collection.cmpfunc = comparator;
-    } else {
-        list->base.collection.cmpfunc = comparator == NULL ? cx_cmp_ptr : comparator;
-        cxListStorePointers((CxList *) list);
-    }
+    cx_list_init((CxList*)list, &cx_linked_list_class,
+            allocator, comparator, elem_size);
 
     return (CxList *) list;
 }

mercurial