MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dictEncObjKeyCompare

Function dictEncObjKeyCompare

app/redis-6.2.6/src/server.c:1316–1336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1314}
1315
1316int dictEncObjKeyCompare(void *privdata, const void *key1,
1317 const void *key2)
1318{
1319 robj *o1 = (robj*) key1, *o2 = (robj*) key2;
1320 int cmp;
1321
1322 if (o1->encoding == OBJ_ENCODING_INT &&
1323 o2->encoding == OBJ_ENCODING_INT)
1324 return o1->ptr == o2->ptr;
1325
1326 /* Due to OBJ_STATIC_REFCOUNT, we avoid calling getDecodedObject() without
1327 * good reasons, because it would incrRefCount() the object, which
1328 * is invalid. So we check to make sure dictFind() works with static
1329 * objects as well. */
1330 if (o1->refcount != OBJ_STATIC_REFCOUNT) o1 = getDecodedObject(o1);
1331 if (o2->refcount != OBJ_STATIC_REFCOUNT) o2 = getDecodedObject(o2);
1332 cmp = dictSdsKeyCompare(privdata,o1->ptr,o2->ptr);
1333 if (o1->refcount != OBJ_STATIC_REFCOUNT) decrRefCount(o1);
1334 if (o2->refcount != OBJ_STATIC_REFCOUNT) decrRefCount(o2);
1335 return cmp;
1336}
1337
1338uint64_t dictEncObjHash(const void *key) {
1339 robj *o = (robj*) key;

Callers

nothing calls this directly

Calls 3

getDecodedObjectFunction · 0.85
decrRefCountFunction · 0.85
dictSdsKeyCompareFunction · 0.70

Tested by

no test coverage detected