| 1430 | } |
| 1431 | |
| 1432 | uint64_t dictEncObjHash(const void *key) { |
| 1433 | robj *o = (robj*) key; |
| 1434 | |
| 1435 | if (sdsEncodedObject(o)) { |
| 1436 | return dictGenHashFunction(ptrFromObj(o), sdslen((sds)ptrFromObj(o))); |
| 1437 | } else if (o->encoding == OBJ_ENCODING_INT) { |
| 1438 | char buf[32]; |
| 1439 | int len; |
| 1440 | |
| 1441 | len = ll2string(buf,32,(long)ptrFromObj(o)); |
| 1442 | return dictGenHashFunction((unsigned char*)buf, len); |
| 1443 | } else { |
| 1444 | serverPanic("Unknown string encoding"); |
| 1445 | } |
| 1446 | } |
| 1447 | |
| 1448 | /* Return 1 if currently we allow dict to expand. Dict may allocate huge |
| 1449 | * memory to contain hash buckets when dict expands, that may lead redis |
nothing calls this directly
no test coverage detected