From ee4c355a3e5f46ed9ce5749228f9c15e2b1be427 Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 6 Dec 2018 11:33:58 +0100 Subject: [PATCH] RESP3: hiredis: implement null type. --- deps/hiredis/read.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/deps/hiredis/read.c b/deps/hiredis/read.c index 2726d4481..32f1c9220 100644 --- a/deps/hiredis/read.c +++ b/deps/hiredis/read.c @@ -308,6 +308,11 @@ static int processLineItem(redisReader *r) { } else { obj = (void*)REDIS_REPLY_DOUBLE; } + } else if (cur->type == REDIS_REPLY_NIL) { + if (r->fn && r->fn->createNil) + obj = r->fn->createNil(cur); + else + obj = (void*)REDIS_REPLY_NIL; } else { /* Type will be error or status. */ if (r->fn && r->fn->createString) @@ -493,6 +498,9 @@ static int processItem(redisReader *r) { case ',': cur->type = REDIS_REPLY_DOUBLE; break; + case '_': + cur->type = REDIS_REPLY_NIL; + break; case '$': cur->type = REDIS_REPLY_STRING; break; @@ -521,6 +529,7 @@ static int processItem(redisReader *r) { case REDIS_REPLY_STATUS: case REDIS_REPLY_INTEGER: case REDIS_REPLY_DOUBLE: + case REDIS_REPLY_NIL: return processLineItem(r); case REDIS_REPLY_STRING: return processBulkItem(r);