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

Function dictFindWithPrev

src/dict.cpp:848–870  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

846}
847
848dictEntry *dictFindWithPrev(dict *d, const void *key, uint64_t h, dictEntry ***dePrevPtr, dictht **pht, bool fShallowCompare)
849{
850 dictEntry *he;
851 uint64_t idx, table;
852
853 if (dictSize(d) == 0) return NULL; /* dict is empty */
854 if (dictIsRehashing(d)) _dictRehashStep(d);
855 for (table = 0; table <= 1; table++) {
856 *pht = d->ht + table;
857 idx = h & d->ht[table].sizemask;
858 he = d->ht[table].table[idx];
859 *dePrevPtr = &d->ht[table].table[idx];
860 while(he) {
861 if (key==he->key || (!fShallowCompare && dictCompareKeys(d, key, he->key))) {
862 return he;
863 }
864 *dePrevPtr = &he->next;
865 he = he->next;
866 }
867 if (!dictIsRehashing(d)) return NULL;
868 }
869 return NULL;
870}
871
872dictEntry *dictFind(dict *d, const void *key)
873{

Callers 4

ensureMethod · 0.85
dictFindFunction · 0.85
freeTombstoneObjectsMethod · 0.85
endSnapshotMethod · 0.85

Calls 1

_dictRehashStepFunction · 0.85

Tested by

no test coverage detected