From 7db723adb22bb98f3c3ca5bf4c35636ee75b25ba Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 20 Nov 2009 09:18:40 +0100 Subject: [PATCH] ZINCRSCOREBY => ZINCRBY --- TODO | 1 - redis-cli.c | 2 +- redis.c | 14 +++++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/TODO b/TODO index a5f51f815..e1b1db6d6 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,6 @@ VERSION 1.1 TODO * For now only the last argument gets integer encoded, so make sure that: 1) every multi bulk commands implemented will have the last arg that is indeed a value, and not used otherwise. 2) to explicitly call the function to encode the object in MSET and other commands where there are multiple "values". * Man pages for MSET MSETNX and SRANDMEMBER, Z-commands, ... -* ZSETs missing stuff: ZINCRBY * Use strcoll() to compare objects in sorted sets, like it already happens for SORT. * LPOPPUSH, EXPIRE, EXPIREAT, ZSCORE, SRANDMEMBER tests. * Write docs for the "STORE" operaiton of SORT, and GET "#" option. diff --git a/redis-cli.c b/redis-cli.c index a1156b107..f34aef830 100644 --- a/redis-cli.c +++ b/redis-cli.c @@ -93,7 +93,7 @@ static struct redisCommand cmdTable[] = { {"sdiffstore",-3,REDIS_CMD_INLINE}, {"smembers",2,REDIS_CMD_INLINE}, {"zadd",4,REDIS_CMD_BULK}, - {"zincrscoreby",4,REDIS_CMD_BULK}, + {"zincrby",4,REDIS_CMD_BULK}, {"zrem",3,REDIS_CMD_BULK}, {"zremrangebyscore",4,REDIS_CMD_INLINE}, {"zrange",4,REDIS_CMD_INLINE}, diff --git a/redis.c b/redis.c index b4be65a60..8b2a79395 100644 --- a/redis.c +++ b/redis.c @@ -466,7 +466,7 @@ static void debugCommand(redisClient *c); static void msetCommand(redisClient *c); static void msetnxCommand(redisClient *c); static void zaddCommand(redisClient *c); -static void zincrscorebyCommand(redisClient *c); +static void zincrbyCommand(redisClient *c); static void zrangeCommand(redisClient *c); static void zrangebyscoreCommand(redisClient *c); static void zrevrangeCommand(redisClient *c); @@ -514,7 +514,7 @@ static struct redisCommand cmdTable[] = { {"sdiffstore",sdiffstoreCommand,-3,REDIS_CMD_INLINE|REDIS_CMD_DENYOOM}, {"smembers",sinterCommand,2,REDIS_CMD_INLINE}, {"zadd",zaddCommand,4,REDIS_CMD_BULK|REDIS_CMD_DENYOOM}, - {"zincrscoreby",zincrscorebyCommand,4,REDIS_CMD_BULK|REDIS_CMD_DENYOOM}, + {"zincrby",zincrbyCommand,4,REDIS_CMD_BULK|REDIS_CMD_DENYOOM}, {"zrem",zremCommand,3,REDIS_CMD_BULK}, {"zremrangebyscore",zremrangebyscoreCommand,4,REDIS_CMD_INLINE}, {"zrange",zrangeCommand,4,REDIS_CMD_INLINE}, @@ -4229,9 +4229,9 @@ static zskiplistNode *zslFirstWithScore(zskiplist *zsl, double score) { /* The actual Z-commands implementations */ -/* This generic command implements both ZADD and ZINCRSCOREBY. +/* This generic command implements both ZADD and ZINCRBY. * scoreval is the score if the operation is a ZADD (doincrement == 0) or - * the increment if the operation is a ZINCRSCOREBY (doincrement == 1). */ + * the increment if the operation is a ZINCRBY (doincrement == 1). */ static void zaddGenericCommand(redisClient *c, robj *key, robj *ele, double scoreval, int doincrement) { robj *zsetobj; zset *zs; @@ -4250,7 +4250,7 @@ static void zaddGenericCommand(redisClient *c, robj *key, robj *ele, double scor } zs = zsetobj->ptr; - /* Ok now since we implement both ZADD and ZINCRSCOREBY here the code + /* Ok now since we implement both ZADD and ZINCRBY here the code * needs to handle the two different conditions. It's all about setting * '*score', that is, the new score to set, to the right value. */ score = zmalloc(sizeof(double)); @@ -4270,7 +4270,7 @@ static void zaddGenericCommand(redisClient *c, robj *key, robj *ele, double scor } /* What follows is a simple remove and re-insert operation that is common - * to both ZADD and ZINCRSCOREBY... */ + * to both ZADD and ZINCRBY... */ if (dictAdd(zs->dict,ele,score) == DICT_OK) { /* case 1: New element */ incrRefCount(ele); /* added to hash */ @@ -4317,7 +4317,7 @@ static void zaddCommand(redisClient *c) { zaddGenericCommand(c,c->argv[1],c->argv[3],scoreval,0); } -static void zincrscorebyCommand(redisClient *c) { +static void zincrbyCommand(redisClient *c) { double scoreval; scoreval = strtod(c->argv[2]->ptr,NULL);