MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / ckh_insert

Function ckh_insert

deps/memkind/src/jemalloc/src/ckh.c:465–486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

463}
464
465bool
466ckh_insert(tsd_t *tsd, ckh_t *ckh, const void *key, const void *data) {
467 bool ret;
468
469 assert(ckh != NULL);
470 assert(ckh_search(ckh, key, NULL, NULL));
471
472#ifdef CKH_COUNT
473 ckh->ninserts++;
474#endif
475
476 while (ckh_try_insert(ckh, &key, &data)) {
477 if (ckh_grow(tsd, ckh)) {
478 ret = true;
479 goto label_return;
480 }
481 }
482
483 ret = false;
484label_return:
485 return ret;
486}
487
488bool
489ckh_remove(tsd_t *tsd, ckh_t *ckh, const void *searchkey, void **key,

Callers 3

prof_lookup_globalFunction · 0.70
prof_lookupFunction · 0.70
TEST_BEGINFunction · 0.50

Calls 3

ckh_searchFunction · 0.70
ckh_try_insertFunction · 0.70
ckh_growFunction · 0.70

Tested by 1

TEST_BEGINFunction · 0.40