MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / getDecodedObject

Function getDecodedObject

src/object.cpp:557–573  ·  view source on GitHub ↗

Get a decoded version of an encoded object (returned as a new object). * If the object is already raw-encoded just increment the ref count. */

Source from the content-addressed store, hash-verified

555/* Get a decoded version of an encoded object (returned as a new object).
556 * If the object is already raw-encoded just increment the ref count. */
557robj *getDecodedObject(robj *o) {
558 robj *dec;
559
560 if (sdsEncodedObject(o)) {
561 incrRefCount(o);
562 return o;
563 }
564 if (o->type == OBJ_STRING && o->encoding == OBJ_ENCODING_INT) {
565 char buf[32];
566
567 ll2string(buf,32,(long)ptrFromObj(o));
568 dec = createStringObject(buf,strlen(buf));
569 return dec;
570 } else {
571 serverPanic("Unknown encoding type");
572 }
573}
574
575robj_roptr getDecodedObject(robj_roptr o) {
576 return getDecodedObject(o.unsafe_robjcast());

Callers 15

dbUnshareStringValueFunction · 0.85
pubsubPublishMessageFunction · 0.85
clusterSendPublishFunction · 0.85
lookupKeyByPatternFunction · 0.85
sortCommandFunction · 0.85
rdbLoadObjectFunction · 0.85
dictEncObjKeyCompareFunction · 0.85
xorStringObjectDigestFunction · 0.85
mixStringObjectDigestFunction · 0.85
logCurrentClientFunction · 0.85
RM_ListPopFunction · 0.85
RM_HashGetFunction · 0.85

Calls 5

incrRefCountFunction · 0.85
ll2stringFunction · 0.85
ptrFromObjFunction · 0.85
unsafe_robjcastMethod · 0.80
createStringObjectFunction · 0.70

Tested by

no test coverage detected