Finds the dictEntry reference by using pointer and pre-calculated hash. * oldkey is a dead pointer and should not be accessed. * the hash value should be provided using dictGetHash. * no string / key comparison is performed. * return value is the reference to the dictEntry if found, or NULL if not found. */
| 1443 | * no string / key comparison is performed. |
| 1444 | * return value is the reference to the dictEntry if found, or NULL if not found. */ |
| 1445 | dictEntry **dictFindEntryRefByPtrAndHash(dict *d, const void *oldptr, uint64_t hash) { |
| 1446 | dictEntry *he, **heref; |
| 1447 | unsigned long idx, table; |
| 1448 | |
| 1449 | if (dictSize(d) == 0) return NULL; /* dict is empty */ |
| 1450 | for (table = 0; table <= 1; table++) { |
| 1451 | idx = hash & d->ht[table].sizemask; |
| 1452 | heref = &d->ht[table].table[idx]; |
| 1453 | he = *heref; |
| 1454 | while(he) { |
| 1455 | if (oldptr==he->key) |
| 1456 | return heref; |
| 1457 | heref = &he->next; |
| 1458 | he = *heref; |
| 1459 | } |
| 1460 | if (!dictIsRehashing(d)) return NULL; |
| 1461 | } |
| 1462 | return NULL; |
| 1463 | } |
| 1464 | |
| 1465 | /* ------------------------------- Debugging ---------------------------------*/ |
| 1466 |
no outgoing calls
no test coverage detected