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

Function decrRefCount

app/redis-6.2.6/src/object.c:376–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

374}
375
376void decrRefCount(robj *o) {
377 if (o->refcount == 1) {
378 switch(o->type) {
379 case OBJ_STRING: freeStringObject(o); break;
380 case OBJ_LIST: freeListObject(o); break;
381 case OBJ_SET: freeSetObject(o); break;
382 case OBJ_ZSET: freeZsetObject(o); break;
383 case OBJ_HASH: freeHashObject(o); break;
384 case OBJ_MODULE: freeModuleObject(o); break;
385 case OBJ_STREAM: freeStreamObject(o); break;
386 default: serverPanic("Unknown object type"); break;
387 }
388 zfree(o);
389 } else {
390 if (o->refcount <= 0) serverPanic("decrRefCount against refcount <= 0");
391 if (o->refcount != OBJ_SHARED_REFCOUNT) o->refcount--;
392 }
393}
394
395/* This variant of decrRefCount() gets its argument as void, and is useful
396 * as free method in data structures that expect a 'void free_object(void*)'

Callers 15

processGopherRequestFunction · 0.85
luaRedisGenericCommandFunction · 0.85
unblockClientWaitingDataFunction · 0.85
pubsubUnsubscribeChannelFunction · 0.85
pubsubUnsubscribePatternFunction · 0.85
pubsubPublishMessageFunction · 0.85
sentinelEventFunction · 0.85
hincrbyfloatCommandFunction · 0.85

Calls 8

freeStringObjectFunction · 0.85
freeListObjectFunction · 0.85
freeSetObjectFunction · 0.85
freeZsetObjectFunction · 0.85
freeHashObjectFunction · 0.85
freeModuleObjectFunction · 0.85
freeStreamObjectFunction · 0.85
zfreeFunction · 0.70

Tested by

no test coverage detected