| 190 cx_pl_sort, |
190 cx_pl_sort, |
| 191 cx_pl_compare, |
191 cx_pl_compare, |
| 192 cx_pl_reverse, |
192 cx_pl_reverse, |
| 193 cx_pl_iterator, |
193 cx_pl_iterator, |
| 194 }; |
194 }; |
| 195 |
|
| 196 void cxListStoreObjects(CxList *list) { |
|
| 197 list->collection.store_pointer = false; |
|
| 198 if (list->climpl != NULL) { |
|
| 199 list->cl = list->climpl; |
|
| 200 list->climpl = NULL; |
|
| 201 } |
|
| 202 } |
|
| 203 |
|
| 204 void cxListStorePointers(CxList *list) { |
|
| 205 list->collection.elem_size = sizeof(void *); |
|
| 206 list->collection.store_pointer = true; |
|
| 207 list->climpl = list->cl; |
|
| 208 list->cl = &cx_pointer_list_class; |
|
| 209 } |
|
| 210 |
|
| 211 // </editor-fold> |
195 // </editor-fold> |
| 212 |
196 |
| 213 // <editor-fold desc="empty list implementation"> |
197 // <editor-fold desc="empty list implementation"> |
| 214 |
198 |
| 215 static void cx_emptyl_noop(cx_attr_unused CxList *list) { |
199 static void cx_emptyl_noop(cx_attr_unused CxList *list) { |
| 413 memcpy(jp, tmp, elem_size); |
397 memcpy(jp, tmp, elem_size); |
| 414 |
398 |
| 415 free(tmp); |
399 free(tmp); |
| 416 |
400 |
| 417 return 0; |
401 return 0; |
| |
402 } |
| |
403 |
| |
404 void cx_list_init( |
| |
405 struct cx_list_s *list, |
| |
406 struct cx_list_class_s *cl, |
| |
407 const struct cx_allocator_s *allocator, |
| |
408 cx_compare_func comparator, |
| |
409 size_t elem_size |
| |
410 ) { |
| |
411 list->cl = cl; |
| |
412 list->collection.allocator = allocator; |
| |
413 list->collection.cmpfunc = comparator; |
| |
414 if (elem_size > 0) { |
| |
415 list->collection.elem_size = elem_size; |
| |
416 } else { |
| |
417 list->collection.elem_size = sizeof(void *); |
| |
418 if (list->collection.cmpfunc == NULL) { |
| |
419 list->collection.cmpfunc = cx_cmp_ptr; |
| |
420 } |
| |
421 list->collection.store_pointer = true; |
| |
422 list->climpl = list->cl; |
| |
423 list->cl = &cx_pointer_list_class; |
| |
424 } |
| 418 } |
425 } |
| 419 |
426 |
| 420 int cxListCompare( |
427 int cxListCompare( |
| 421 const CxList *list, |
428 const CxList *list, |
| 422 const CxList *other |
429 const CxList *other |