mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
make memory usage consistent of robj with OBJ_ENCODING_INT
This commit is contained in:
parent
49816941a4
commit
004c26ec28
13
src/object.c
13
src/object.c
@ -455,10 +455,15 @@ robj *tryObjectEncoding(robj *o) {
|
|||||||
incrRefCount(shared.integers[value]);
|
incrRefCount(shared.integers[value]);
|
||||||
return shared.integers[value];
|
return shared.integers[value];
|
||||||
} else {
|
} else {
|
||||||
if (o->encoding == OBJ_ENCODING_RAW) sdsfree(o->ptr);
|
if (o->encoding == OBJ_ENCODING_RAW) {
|
||||||
o->encoding = OBJ_ENCODING_INT;
|
sdsfree(o->ptr);
|
||||||
o->ptr = (void*) value;
|
o->encoding = OBJ_ENCODING_INT;
|
||||||
return o;
|
o->ptr = (void*) value;
|
||||||
|
return o;
|
||||||
|
} else {
|
||||||
|
decrRefCount(o);
|
||||||
|
return createStringObjectFromLongLongForValue(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user