913 cx_linked_list *list = cxCalloc(allocator, 1, sizeof(cx_linked_list)); |
914 cx_linked_list *list = cxCalloc(allocator, 1, sizeof(cx_linked_list)); |
914 if (list == NULL) return NULL; |
915 if (list == NULL) return NULL; |
915 |
916 |
916 list->base.cl = &cx_linked_list_class; |
917 list->base.cl = &cx_linked_list_class; |
917 list->base.allocator = allocator; |
918 list->base.allocator = allocator; |
918 list->base.cmpfunc = comparator; |
|
919 |
919 |
920 if (item_size > 0) { |
920 if (item_size > 0) { |
921 list->base.item_size = item_size; |
921 list->base.item_size = item_size; |
922 } else { |
922 list->base.cmpfunc = comparator; |
|
923 } else { |
|
924 list->base.cmpfunc = comparator == NULL ? cx_cmp_ptr : comparator; |
923 cxListStorePointers((CxList *) list); |
925 cxListStorePointers((CxList *) list); |
924 } |
926 } |
925 |
927 |
926 return (CxList *) list; |
928 return (CxList *) list; |
927 } |
929 } |