src/kv_list.c

changeset 1618
ef7cab6eb131
parent 1605
55b13f583356
equal deleted inserted replaced
1617:d4385f35f8b0 1618:ef7cab6eb131
219 // (the first to find the index, the second to get a pointer) 219 // (the first to find the index, the second to get a pointer)
220 if (list->collection.size == 0) return 0; 220 if (list->collection.size == 0) return 0;
221 221
222 size_t index; 222 size_t index;
223 cx_linked_list *ll = &kv_list->list; 223 cx_linked_list *ll = &kv_list->list;
224 char *node = cx_linked_list_find( 224 char *node = cx_linked_list_find_c(
225 ll->begin, 225 ll->begin,
226 ll->loc_next, ll->loc_data, 226 ll->loc_next, ll->loc_data,
227 list->collection.cmpfunc, elem, 227 elem, &index,
228 &index 228 cx_list_compare_wrapper,
229 list
229 ); 230 );
230 if (node == NULL) { 231 if (node == NULL) {
231 return list->collection.size; 232 return list->collection.size;
232 } 233 }
233 if (remove) { 234 if (remove) {
597 kv_map->list = kv_list; 598 kv_map->list = kv_list;
598 599
599 // remember the base methods and override them 600 // remember the base methods and override them
600 kv_list->map_methods = map->cl; 601 kv_list->map_methods = map->cl;
601 map->cl = &cx_kv_map_class; 602 map->cl = &cx_kv_map_class;
602 if (list->climpl == NULL) { 603 kv_list->list_methods = list->cl;
603 kv_list->list_methods = list->cl; 604 list->cl = &cx_kv_list_class;
604 list->cl = &cx_kv_list_class;
605 } else {
606 kv_list->list_methods = list->climpl;
607 list->climpl = &cx_kv_list_class;
608 }
609 605
610 return list; 606 return list;
611 } 607 }
612 608
613 CxMap *cxKvListCreateAsMap( 609 CxMap *cxKvListCreateAsMap(

mercurial