Unverified Commit f491eee2 authored by Huang Zhw's avatar Huang Zhw Committed by GitHub
Browse files

Cleanup: dictEncObjHash remove redundant conditional statement (#8488)

parent e8e6ca63
...@@ -1332,21 +1332,14 @@ uint64_t dictEncObjHash(const void *key) { ...@@ -1332,21 +1332,14 @@ uint64_t dictEncObjHash(const void *key) {
if (sdsEncodedObject(o)) { if (sdsEncodedObject(o)) {
return dictGenHashFunction(o->ptr, sdslen((sds)o->ptr)); return dictGenHashFunction(o->ptr, sdslen((sds)o->ptr));
} else { } else if (o->encoding == OBJ_ENCODING_INT) {
if (o->encoding == OBJ_ENCODING_INT) { char buf[32];
char buf[32]; int len;
int len;
len = ll2string(buf,32,(long)o->ptr);
return dictGenHashFunction((unsigned char*)buf, len);
} else {
uint64_t hash;
o = getDecodedObject(o); len = ll2string(buf,32,(long)o->ptr);
hash = dictGenHashFunction(o->ptr, sdslen((sds)o->ptr)); return dictGenHashFunction((unsigned char*)buf, len);
decrRefCount(o); } else {
return hash; serverPanic("Unknown string encoding");
}
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment