Utility function that replaces an old key pointer in the dictionary with a * new pointer. Additionally, we try to defrag the dictEntry in that dict. * Oldkey mey be a dead pointer and should not be accessed (we get a * pre-calculated hash value). Newkey may be null if the key pointer wasn't * moved. Return value is the the dictEntry if found, or NULL if not found. * NOTE: this is very ugly co
| 409 | * NOTE: this is very ugly code, but it let's us avoid the complication of |
| 410 | * doing a scan on another dict. */ |
| 411 | dictEntry* replaceSatelliteDictKeyPtrAndOrDefragDictEntry(dict *d, sds oldkey, sds newkey, uint64_t hash, long *defragged) { |
| 412 | dictEntry **deref = dictFindEntryRefByPtrAndHash(d, oldkey, hash); |
| 413 | if (deref) { |
| 414 | dictEntry *de = *deref; |
| 415 | dictEntry *newde = (dictEntry*)activeDefragAlloc(de); |
| 416 | if (newde) { |
| 417 | de = *deref = newde; |
| 418 | (*defragged)++; |
| 419 | } |
| 420 | if (newkey) |
| 421 | de->key = newkey; |
| 422 | return de; |
| 423 | } |
| 424 | return NULL; |
| 425 | } |
| 426 | |
| 427 | long activeDefragQuickListNode(quicklist *ql, quicklistNode **node_ref) { |
| 428 | quicklistNode *newnode, *node = *node_ref; |
nothing calls this directly
no test coverage detected