From aa7c29340f87889467f343a8783bc9908df5483d Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Mon, 5 Apr 2010 16:51:48 +0200 Subject: [PATCH] use long long reply type for HINCRBY --- redis.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/redis.c b/redis.c index e4ddd99c..85244859 100644 --- a/redis.c +++ b/redis.c @@ -2601,6 +2601,21 @@ static void addReplyLong(redisClient *c, long l) { addReplySds(c,sdsnewlen(buf,len)); } +static void addReplyLongLong(redisClient *c, long long ll) { + char buf[128]; + size_t len; + + if (ll == 0) { + addReply(c,shared.czero); + return; + } else if (ll == 1) { + addReply(c,shared.cone); + return; + } + len = snprintf(buf,sizeof(buf),":%lld\r\n",ll); + addReplySds(c,sdsnewlen(buf,len)); +} + static void addReplyUlong(redisClient *c, unsigned long ul) { char buf[128]; size_t len; @@ -6088,7 +6103,7 @@ static void hincrbyCommand(redisClient *c) { } server.dirty++; - addReplyLong(c, value); + addReplyLongLong(c, value); } static void hgetCommand(redisClient *c) { -- 2.47.2