summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Nunberg <mnunberg@haskalah.org>2018-12-12 11:36:52 -0500
committerMark Nunberg <mnunberg@haskalah.org>2019-02-20 09:10:10 -0500
commitf4f6b6d65c83df53ac4e7a6730440ea7af368fcd (patch)
treec98d4b13610c745bf6df7e6e468be342eb6b0977
parent7b705936f66f34f79ec0bc45c6c7cf4ab40296e7 (diff)
minor fixes: initialize options struct with 0 always
also, clean up redisContextInit -- we're just zeoring the struct
-rw-r--r--hiredis.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/hiredis.c b/hiredis.c
index d33e393..7ba51f6 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -591,21 +591,14 @@ static redisContext *redisContextInit(const redisOptions *options) {
if (c == NULL)
return NULL;
- c->err = 0;
- c->errstr[0] = '\0';
c->obuf = sdsempty();
- c->flags = 0;
- c->tcp.host = NULL;
- c->tcp.source_addr = NULL;
- c->unix_sock.path = NULL;
- c->timeout = NULL;
c->reader = redisReaderCreate();
if (c->obuf == NULL || c->reader == NULL) {
redisFree(c);
return NULL;
}
-
+ (void)options; /* options are used in other functions */
return c;
}
@@ -753,7 +746,8 @@ redisContext *redisConnectUnixNonBlock(const char *path) {
}
redisContext *redisConnectFd(int fd) {
- redisOptions options = {REDIS_CONN_USERFD};
+ redisOptions options = {0};
+ options.type = REDIS_CONN_USERFD;
options.endpoint.fd = fd;
return redisConnectWithOptions(&options);
}