| 1136 allocator = cxDefaultAllocator; |
1136 allocator = cxDefaultAllocator; |
| 1137 } |
1137 } |
| 1138 |
1138 |
| 1139 cx_linked_list *list = cxCalloc(allocator, 1, sizeof(cx_linked_list)); |
1139 cx_linked_list *list = cxCalloc(allocator, 1, sizeof(cx_linked_list)); |
| 1140 if (list == NULL) return NULL; |
1140 if (list == NULL) return NULL; |
| 1141 |
1141 cx_list_init((CxList*)list, &cx_linked_list_class, |
| 1142 list->base.cl = &cx_linked_list_class; |
1142 allocator, comparator, elem_size); |
| 1143 list->base.collection.allocator = allocator; |
|
| 1144 |
|
| 1145 if (elem_size > 0) { |
|
| 1146 list->base.collection.elem_size = elem_size; |
|
| 1147 list->base.collection.cmpfunc = comparator; |
|
| 1148 } else { |
|
| 1149 list->base.collection.cmpfunc = comparator == NULL ? cx_cmp_ptr : comparator; |
|
| 1150 cxListStorePointers((CxList *) list); |
|
| 1151 } |
|
| 1152 |
1143 |
| 1153 return (CxList *) list; |
1144 return (CxList *) list; |
| 1154 } |
1145 } |