Merge pull request #3828 from oranagra/sdsnewlen_pr

add SDS_NOINIT option to sdsnewlen to avoid unnecessary memsets.
This commit is contained in:
Salvatore Sanfilippo
2018-02-27 04:04:32 -08:00
committed by GitHub
6 changed files with 19 additions and 11 deletions

View File

@ -1306,7 +1306,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 {
@ -1585,7 +1585,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) {