]> git.saurik.com Git - redis.git/commitdiff
use long long reply type for HINCRBY
authorPieter Noordhuis <pcnoordhuis@gmail.com>
Mon, 5 Apr 2010 14:51:48 +0000 (16:51 +0200)
committerPieter Noordhuis <pcnoordhuis@gmail.com>
Mon, 5 Apr 2010 14:51:48 +0000 (16:51 +0200)
redis.c

diff --git a/redis.c b/redis.c
index e4ddd99c0431dde468c651843883bbbabedbdd76..85244859b16f028f734acbad899917295f18166c 100644 (file)
--- 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) {