| 510 |
510 |
| 511 void cx_list_init( |
511 void cx_list_init( |
| 512 struct cx_list_s *list, |
512 struct cx_list_s *list, |
| 513 struct cx_list_class_s *cl, |
513 struct cx_list_class_s *cl, |
| 514 const struct cx_allocator_s *allocator, |
514 const struct cx_allocator_s *allocator, |
| 515 cx_compare_func comparator, |
|
| 516 size_t elem_size |
515 size_t elem_size |
| 517 ) { |
516 ) { |
| 518 list->cl = cl; |
517 list->cl = cl; |
| 519 list->collection.allocator = allocator; |
518 list->collection.allocator = allocator; |
| 520 list->collection.cmpfunc = comparator; |
519 list->collection.cmpfunc = NULL; |
| 521 if (elem_size > 0) { |
520 if (elem_size > 0) { |
| 522 list->collection.elem_size = elem_size; |
521 list->collection.elem_size = elem_size; |
| 523 } else { |
522 } else { |
| 524 list->collection.elem_size = sizeof(void *); |
523 list->collection.elem_size = sizeof(void *); |
| 525 if (list->collection.cmpfunc == NULL) { |
524 if (list->collection.cmpfunc == NULL) { |