Cleanup: dictEncObjHash remove redundant conditional statement (#8488)
This commit is contained in:
parent
d2b53f6d1e
commit
e7a97ad453
21
src/server.c
21
src/server.c
@ -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 if (o->encoding == OBJ_ENCODING_INT) {
|
||||||
|
char buf[32];
|
||||||
|
int len;
|
||||||
|
|
||||||
|
len = ll2string(buf,32,(long)o->ptr);
|
||||||
|
return dictGenHashFunction((unsigned char*)buf, len);
|
||||||
} else {
|
} else {
|
||||||
if (o->encoding == OBJ_ENCODING_INT) {
|
serverPanic("Unknown string encoding");
|
||||||
char buf[32];
|
|
||||||
int len;
|
|
||||||
|
|
||||||
len = ll2string(buf,32,(long)o->ptr);
|
|
||||||
return dictGenHashFunction((unsigned char*)buf, len);
|
|
||||||
} else {
|
|
||||||
uint64_t hash;
|
|
||||||
|
|
||||||
o = getDecodedObject(o);
|
|
||||||
hash = dictGenHashFunction(o->ptr, sdslen((sds)o->ptr));
|
|
||||||
decrRefCount(o);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user