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

@ -1234,7 +1234,7 @@ int processMultibulkBuffer(client *c) {
sdsIncrLen(c->querybuf,-2); /* remove CRLF */
/* Assume that if we saw a fat argument we'll see another one
* likely... */
c->querybuf = sdsnewlen(NULL,c->bulklen+2);
c->querybuf = sdsnewlen(SDS_NOINIT,c->bulklen+2);
sdsclear(c->querybuf);
pos = 0;
} else {
@ -1477,7 +1477,7 @@ sds getAllClientsInfoString(void) {
listNode *ln;
listIter li;
client *client;
sds o = sdsnewlen(NULL,200*listLength(server.clients));
sds o = sdsnewlen(SDS_NOINIT,200*listLength(server.clients));
sdsclear(o);
listRewind(server.clients,&li);
while ((ln = listNext(&li)) != NULL) {