diff -r 4523f6d42512 -r 741a2040fa33 src/linked_list.c --- a/src/linked_list.c Mon Dec 18 16:04:21 2023 +0100 +++ b/src/linked_list.c Mon Dec 18 16:14:07 2023 +0100 @@ -28,6 +28,7 @@ #include "cx/linked_list.h" #include "cx/utils.h" +#include "cx/compare.h" #include #include @@ -915,11 +916,12 @@ list->base.cl = &cx_linked_list_class; list->base.allocator = allocator; - list->base.cmpfunc = comparator; if (item_size > 0) { list->base.item_size = item_size; + list->base.cmpfunc = comparator; } else { + list->base.cmpfunc = comparator == NULL ? cx_cmp_ptr : comparator; cxListStorePointers((CxList *) list); }