Improve comments after merging #5834.

This commit is contained in:
antirez
2019-03-14 12:47:36 +01:00
parent 0cce98f2f9
commit d292a51618
2 changed files with 14 additions and 8 deletions

View File

@ -415,10 +415,11 @@ int isObjectRepresentableAsLongLong(robj *o, long long *llval) {
}
}
/* Optimize the SDS string inside the string object to require little space,
* in case there is more than 10% of free space at the end of the SDS
* string. This happens because SDS strings tend to overallocate to avoid
* wasting too much time in allocations when appending to the string. */
void trimStringObjectIfNeeded(robj *o) {
/* Optimize the SDS string inside the string object to require
* little space, in case there is more than 10% of free space
* at the end of the SDS string. */
if (o->encoding == OBJ_ENCODING_RAW &&
sdsavail(o->ptr) > sdslen(o->ptr)/10)
{