Unverified Commit 73316758 authored by Salvatore Sanfilippo's avatar Salvatore Sanfilippo Committed by GitHub
Browse files

Merge pull request #7152 from oranagra/dict_find_static_robj

allow dictFind using static robj
parents 911a2d6c 09a5c078
...@@ -1219,11 +1219,16 @@ int dictEncObjKeyCompare(void *privdata, const void *key1, ...@@ -1219,11 +1219,16 @@ int dictEncObjKeyCompare(void *privdata, const void *key1,
o2->encoding == OBJ_ENCODING_INT) o2->encoding == OBJ_ENCODING_INT)
return o1->ptr == o2->ptr; return o1->ptr == o2->ptr;
o1 = getDecodedObject(o1); /* due to OBJ_STATIC_REFCOUNT, we rather not call sdsEncodedObject unnecessarily */
o2 = getDecodedObject(o2); if (!sdsEncodedObject(o1))
o1 = getDecodedObject(o1);
if (!sdsEncodedObject(o2))
o2 = getDecodedObject(o2);
cmp = dictSdsKeyCompare(privdata,o1->ptr,o2->ptr); cmp = dictSdsKeyCompare(privdata,o1->ptr,o2->ptr);
decrRefCount(o1); if (o1!=key1)
decrRefCount(o2); decrRefCount(o1);
if (o2!=key2)
decrRefCount(o2);
return cmp; return cmp;
} }
......
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