src/kv_list.c

changeset 1377
1562bdf948da
parent 1376
0698e573936f
child 1378
1b4fa55f7caa
equal deleted inserted replaced
1376:0698e573936f 1377:1562bdf948da
469 *loc_key = key; 469 *loc_key = key;
470 470
471 return 0; 471 return 0;
472 } 472 }
473 473
474 int cx_kv_list_remove_key(CxList *list, size_t index, CxHashKey key) { 474 int cxKvListRemoveKey(CxList *list, size_t index) {
475 return -1; 475 cx_kv_list *kv_list = (cx_kv_list*)list;
476 void *node_data = kv_list->list_methods->at(list, index);
477 if (node_data == NULL) {
478 return 1;
479 }
480 CxHashKey *loc_key = cx_kv_list_loc_key(kv_list, node_data);
481 if (loc_key->hash == 0) {
482 return 0;
483 }
484 kv_list->map_methods->remove(&kv_list->map->map_base.base, *loc_key, NULL);
485 // also zero the memory in the list node,
486 // but don't free the key data (that was done by the map remove)
487 memset(loc_key, 0, sizeof(CxHashKey));
488 return 0;
476 } 489 }
477 490
478 int cx_kv_list_insert(CxList *list, size_t index, CxHashKey key, void *value) { 491 int cx_kv_list_insert(CxList *list, size_t index, CxHashKey key, void *value) {
479 return -1; 492 return -1;
480 } 493 }

mercurial