From 0cbe10e892045dc4cba8d1bf3a8193b2cd8506ae Mon Sep 17 00:00:00 2001 From: Hanif Ariffin Date: Sun, 6 Nov 2022 14:33:28 +0800 Subject: [PATCH] Remove redundant calls to update refcount of shared integers (#11479) Since they're created with makeObjectShared, then incrRefCount on them is a NOP. Signed-off-by: Hanif Bin Ariffin --- src/object.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/object.c b/src/object.c index 6a5e85e9d4..44fd5befdc 100644 --- a/src/object.c +++ b/src/object.c @@ -158,7 +158,6 @@ robj *createStringObjectFromLongLongWithOptions(long long value, int valueobj) { } if (value >= 0 && value < OBJ_SHARED_INTEGERS && valueobj == 0) { - incrRefCount(shared.integers[value]); o = shared.integers[value]; } else { if (value >= LONG_MIN && value <= LONG_MAX) { @@ -636,7 +635,6 @@ robj *tryObjectEncoding(robj *o) { value < OBJ_SHARED_INTEGERS) { decrRefCount(o); - incrRefCount(shared.integers[value]); return shared.integers[value]; } else { if (o->encoding == OBJ_ENCODING_RAW) {