1.1 --- a/src/linked_list.c Mon Dec 18 16:04:21 2023 +0100 1.2 +++ b/src/linked_list.c Mon Dec 18 16:14:07 2023 +0100 1.3 @@ -28,6 +28,7 @@ 1.4 1.5 #include "cx/linked_list.h" 1.6 #include "cx/utils.h" 1.7 +#include "cx/compare.h" 1.8 #include <string.h> 1.9 #include <assert.h> 1.10 1.11 @@ -915,11 +916,12 @@ 1.12 1.13 list->base.cl = &cx_linked_list_class; 1.14 list->base.allocator = allocator; 1.15 - list->base.cmpfunc = comparator; 1.16 1.17 if (item_size > 0) { 1.18 list->base.item_size = item_size; 1.19 + list->base.cmpfunc = comparator; 1.20 } else { 1.21 + list->base.cmpfunc = comparator == NULL ? cx_cmp_ptr : comparator; 1.22 cxListStorePointers((CxList *) list); 1.23 } 1.24