]> git.saurik.com Git - redis.git/commitdiff
Merge branch 'issue_218' of git://github.com/pietern/redis
authorantirez <antirez@gmail.com>
Thu, 8 Apr 2010 14:07:26 +0000 (16:07 +0200)
committerantirez <antirez@gmail.com>
Thu, 8 Apr 2010 14:07:26 +0000 (16:07 +0200)
1  2 
redis.c

diff --combined redis.c
index f3db24265bcbedf56edc6e68298b92dd611fe092,85244859b16f028f734acbad899917295f18166c..b1fbb524c719c7f0bb6e36d2d8dbc1d4d62936e7
+++ b/redis.c
@@@ -1223,7 -1223,7 +1223,7 @@@ void backgroundSaveDoneHandler(int stat
          redisLog(REDIS_WARNING, "Background saving error");
      } else {
          redisLog(REDIS_WARNING,
 -            "Background saving terminated by signal");
 +            "Background saving terminated by signal %d", WTERMSIG(statloc));
          rdbRemoveTempFile(server.bgsavechildpid);
      }
      server.bgsavechildpid = -1;
@@@ -1284,8 -1284,7 +1284,8 @@@ void backgroundRewriteDoneHandler(int s
          redisLog(REDIS_WARNING, "Background append only file rewriting error");
      } else {
          redisLog(REDIS_WARNING,
 -            "Background append only file rewriting terminated by signal");
 +            "Background append only file rewriting terminated by signal %d",
 +            WTERMSIG(statloc));
      }
  cleanup:
      sdsfree(server.bgrewritebuf);
@@@ -2602,6 -2601,21 +2602,21 @@@ static void addReplyLong(redisClient *c
      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;
@@@ -5092,7 -5106,7 +5107,7 @@@ static int zslRandomLevel(void) 
      int level = 1;
      while ((random()&0xFFFF) < (ZSKIPLIST_P * 0xFFFF))
          level += 1;
 -    return level;
 +    return (level<ZSKIPLIST_MAXLEVEL) ? level : ZSKIPLIST_MAXLEVEL;
  }
  
  static void zslInsert(zskiplist *zsl, double score, robj *obj) {
@@@ -6038,10 -6052,7 +6053,7 @@@ static void hincrbyCommand(redisClient 
          }
      }
  
-     robj *o_incr = getDecodedObject(c->argv[3]);
-     incr = strtoll(o_incr->ptr, NULL, 10);
-     decrRefCount(o_incr);
+     incr = strtoll(c->argv[3]->ptr, NULL, 10);
      if (o->encoding == REDIS_ENCODING_ZIPMAP) {
          unsigned char *zm = o->ptr;
          unsigned char *zval;
      }
  
      server.dirty++;
-     addReplyLong(c, value);
+     addReplyLongLong(c, value);
  }
  
  static void hgetCommand(redisClient *c) {