add SDS_NOINIT option to sdsnewlen to avoid unnecessary memsets.

this commit also contains small bugfix in rdbLoadLzfStringObject
a bug that currently has no implications.
This commit is contained in:
oranagra
2017-02-23 03:04:08 -08:00
parent 95883313b5
commit f86df924b0
6 changed files with 19 additions and 11 deletions

View File

@ -98,7 +98,9 @@ robj *createEmbeddedStringObject(const char *ptr, size_t len) {
sh->len = len;
sh->alloc = len;
sh->flags = SDS_TYPE_8;
if (ptr) {
if (ptr == SDS_NOINIT)
sh->buf[len] = '\0';
else if (ptr) {
memcpy(sh->buf,ptr,len);
sh->buf[len] = '\0';
} else {