Remove redundant zero stores
calloc is guaranteed to provide a zero-initialized buffer. There is no need to set fields to zero explicitly. Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
This commit is contained in:
parent
546d9415e1
commit
54acc8f087
@ -596,14 +596,8 @@ static redisContext *redisContextInit(void) {
|
|||||||
if (c == NULL)
|
if (c == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
c->err = 0;
|
|
||||||
c->errstr[0] = '\0';
|
|
||||||
c->obuf = sdsempty();
|
c->obuf = sdsempty();
|
||||||
c->reader = redisReaderCreate();
|
c->reader = redisReaderCreate();
|
||||||
c->tcp.host = NULL;
|
|
||||||
c->tcp.source_addr = NULL;
|
|
||||||
c->unix_sock.path = NULL;
|
|
||||||
c->timeout = NULL;
|
|
||||||
|
|
||||||
if (c->obuf == NULL || c->reader == NULL) {
|
if (c->obuf == NULL || c->reader == NULL) {
|
||||||
redisFree(c);
|
redisFree(c);
|
||||||
|
2
read.c
2
read.c
@ -420,8 +420,6 @@ redisReader *redisReaderCreateWithFunctions(redisReplyObjectFunctions *fn) {
|
|||||||
if (r == NULL)
|
if (r == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
r->err = 0;
|
|
||||||
r->errstr[0] = '\0';
|
|
||||||
r->fn = fn;
|
r->fn = fn;
|
||||||
r->buf = sdsempty();
|
r->buf = sdsempty();
|
||||||
r->maxbuf = REDIS_READER_MAX_BUF;
|
r->maxbuf = REDIS_READER_MAX_BUF;
|
||||||
|
Loading…
Reference in New Issue
Block a user