Commit 554bd0e7 authored by antirez's avatar antirez
Browse files

RDMF: use client instead of redisClient, like Disque.

parent 424fe9af
This diff is collapsed.
......@@ -127,7 +127,7 @@ void slowlogReset(void) {
/* The SLOWLOG command. Implements all the subcommands needed to handle the
* Redis slow log. */
void slowlogCommand(redisClient *c) {
void slowlogCommand(client *c) {
if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"reset")) {
slowlogReset();
addReply(c,shared.ok);
......
......@@ -44,4 +44,4 @@ void slowlogInit(void);
void slowlogPushEntryIfNeeded(robj **argv, int argc, long long duration);
/* Exported commands */
void slowlogCommand(redisClient *c);
void slowlogCommand(client *c);
......@@ -186,7 +186,7 @@ int sortCompare(const void *s1, const void *s2) {
/* The SORT command is the most complex command in Redis. Warning: this code
* is optimized for speed and a bit less for readability */
void sortCommand(redisClient *c) {
void sortCommand(client *c) {
list *operations;
unsigned int outputlen = 0;
int desc = 0, alpha = 0;
......
......@@ -415,7 +415,7 @@ robj *hashTypeCurrentObject(hashTypeIterator *hi, int what) {
return dst;
}
robj *hashTypeLookupWriteOrCreate(redisClient *c, robj *key) {
robj *hashTypeLookupWriteOrCreate(client *c, robj *key) {
robj *o = lookupKeyWrite(c->db,key);
if (o == NULL) {
o = createHashObject();
......@@ -483,7 +483,7 @@ void hashTypeConvert(robj *o, int enc) {
* Hash type commands
*----------------------------------------------------------------------------*/
void hsetCommand(redisClient *c) {
void hsetCommand(client *c) {
int update;
robj *o;
......@@ -497,7 +497,7 @@ void hsetCommand(redisClient *c) {
server.dirty++;
}
void hsetnxCommand(redisClient *c) {
void hsetnxCommand(client *c) {
robj *o;
if ((o = hashTypeLookupWriteOrCreate(c,c->argv[1])) == NULL) return;
hashTypeTryConversion(o,c->argv,2,3);
......@@ -514,7 +514,7 @@ void hsetnxCommand(redisClient *c) {
}
}
void hmsetCommand(redisClient *c) {
void hmsetCommand(client *c) {
int i;
robj *o;
......@@ -535,7 +535,7 @@ void hmsetCommand(redisClient *c) {
server.dirty++;
}
void hincrbyCommand(redisClient *c) {
void hincrbyCommand(client *c) {
long long value, incr, oldvalue;
robj *o, *current, *new;
......@@ -569,7 +569,7 @@ void hincrbyCommand(redisClient *c) {
server.dirty++;
}
void hincrbyfloatCommand(redisClient *c) {
void hincrbyfloatCommand(client *c) {
double long value, incr;
robj *o, *current, *new, *aux;
......@@ -605,7 +605,7 @@ void hincrbyfloatCommand(redisClient *c) {
decrRefCount(new);
}
static void addHashFieldToReply(redisClient *c, robj *o, robj *field) {
static void addHashFieldToReply(client *c, robj *o, robj *field) {
int ret;
if (o == NULL) {
......@@ -644,7 +644,7 @@ static void addHashFieldToReply(redisClient *c, robj *o, robj *field) {
}
}
void hgetCommand(redisClient *c) {
void hgetCommand(client *c) {
robj *o;
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk)) == NULL ||
......@@ -653,7 +653,7 @@ void hgetCommand(redisClient *c) {
addHashFieldToReply(c, o, c->argv[2]);
}
void hmgetCommand(redisClient *c) {
void hmgetCommand(client *c) {
robj *o;
int i;
......@@ -671,7 +671,7 @@ void hmgetCommand(redisClient *c) {
}
}
void hdelCommand(redisClient *c) {
void hdelCommand(client *c) {
robj *o;
int j, deleted = 0, keyremoved = 0;
......@@ -699,7 +699,7 @@ void hdelCommand(redisClient *c) {
addReplyLongLong(c,deleted);
}
void hlenCommand(redisClient *c) {
void hlenCommand(client *c) {
robj *o;
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
......@@ -708,7 +708,7 @@ void hlenCommand(redisClient *c) {
addReplyLongLong(c,hashTypeLength(o));
}
void hstrlenCommand(redisClient *c) {
void hstrlenCommand(client *c) {
robj *o;
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
......@@ -716,7 +716,7 @@ void hstrlenCommand(redisClient *c) {
addReplyLongLong(c,hashTypeGetValueLength(o,c->argv[2]));
}
static void addHashIteratorCursorToReply(redisClient *c, hashTypeIterator *hi, int what) {
static void addHashIteratorCursorToReply(client *c, hashTypeIterator *hi, int what) {
if (hi->encoding == REDIS_ENCODING_ZIPLIST) {
unsigned char *vstr = NULL;
unsigned int vlen = UINT_MAX;
......@@ -740,7 +740,7 @@ static void addHashIteratorCursorToReply(redisClient *c, hashTypeIterator *hi, i
}
}
void genericHgetallCommand(redisClient *c, int flags) {
void genericHgetallCommand(client *c, int flags) {
robj *o;
hashTypeIterator *hi;
int multiplier = 0;
......@@ -771,19 +771,19 @@ void genericHgetallCommand(redisClient *c, int flags) {
redisAssert(count == length);
}
void hkeysCommand(redisClient *c) {
void hkeysCommand(client *c) {
genericHgetallCommand(c,REDIS_HASH_KEY);
}
void hvalsCommand(redisClient *c) {
void hvalsCommand(client *c) {
genericHgetallCommand(c,REDIS_HASH_VALUE);
}
void hgetallCommand(redisClient *c) {
void hgetallCommand(client *c) {
genericHgetallCommand(c,REDIS_HASH_KEY|REDIS_HASH_VALUE);
}
void hexistsCommand(redisClient *c) {
void hexistsCommand(client *c) {
robj *o;
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
checkType(c,o,REDIS_HASH)) return;
......@@ -791,7 +791,7 @@ void hexistsCommand(redisClient *c) {
addReply(c, hashTypeExists(o,c->argv[2]) ? shared.cone : shared.czero);
}
void hscanCommand(redisClient *c) {
void hscanCommand(client *c) {
robj *o;
unsigned long cursor;
......
......@@ -194,7 +194,7 @@ void listTypeConvert(robj *subject, int enc) {
* List Commands
*----------------------------------------------------------------------------*/
void pushGenericCommand(redisClient *c, int where) {
void pushGenericCommand(client *c, int where) {
int j, waiting = 0, pushed = 0;
robj *lobj = lookupKeyWrite(c->db,c->argv[1]);
......@@ -224,15 +224,15 @@ void pushGenericCommand(redisClient *c, int where) {
server.dirty += pushed;
}
void lpushCommand(redisClient *c) {
void lpushCommand(client *c) {
pushGenericCommand(c,REDIS_HEAD);
}
void rpushCommand(redisClient *c) {
void rpushCommand(client *c) {
pushGenericCommand(c,REDIS_TAIL);
}
void pushxGenericCommand(redisClient *c, robj *refval, robj *val, int where) {
void pushxGenericCommand(client *c, robj *refval, robj *val, int where) {
robj *subject;
listTypeIterator *iter;
listTypeEntry entry;
......@@ -275,17 +275,17 @@ void pushxGenericCommand(redisClient *c, robj *refval, robj *val, int where) {
addReplyLongLong(c,listTypeLength(subject));
}
void lpushxCommand(redisClient *c) {
void lpushxCommand(client *c) {
c->argv[2] = tryObjectEncoding(c->argv[2]);
pushxGenericCommand(c,NULL,c->argv[2],REDIS_HEAD);
}
void rpushxCommand(redisClient *c) {
void rpushxCommand(client *c) {
c->argv[2] = tryObjectEncoding(c->argv[2]);
pushxGenericCommand(c,NULL,c->argv[2],REDIS_TAIL);
}
void linsertCommand(redisClient *c) {
void linsertCommand(client *c) {
c->argv[4] = tryObjectEncoding(c->argv[4]);
if (strcasecmp(c->argv[2]->ptr,"after") == 0) {
pushxGenericCommand(c,c->argv[3],c->argv[4],REDIS_TAIL);
......@@ -296,13 +296,13 @@ void linsertCommand(redisClient *c) {
}
}
void llenCommand(redisClient *c) {
void llenCommand(client *c) {
robj *o = lookupKeyReadOrReply(c,c->argv[1],shared.czero);
if (o == NULL || checkType(c,o,REDIS_LIST)) return;
addReplyLongLong(c,listTypeLength(o));
}
void lindexCommand(redisClient *c) {
void lindexCommand(client *c) {
robj *o = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk);
if (o == NULL || checkType(c,o,REDIS_LIST)) return;
long index;
......@@ -329,7 +329,7 @@ void lindexCommand(redisClient *c) {
}
}
void lsetCommand(redisClient *c) {
void lsetCommand(client *c) {
robj *o = lookupKeyWriteOrReply(c,c->argv[1],shared.nokeyerr);
if (o == NULL || checkType(c,o,REDIS_LIST)) return;
long index;
......@@ -355,7 +355,7 @@ void lsetCommand(redisClient *c) {
}
}
void popGenericCommand(redisClient *c, int where) {
void popGenericCommand(client *c, int where) {
robj *o = lookupKeyWriteOrReply(c,c->argv[1],shared.nullbulk);
if (o == NULL || checkType(c,o,REDIS_LIST)) return;
......@@ -378,15 +378,15 @@ void popGenericCommand(redisClient *c, int where) {
}
}
void lpopCommand(redisClient *c) {
void lpopCommand(client *c) {
popGenericCommand(c,REDIS_HEAD);
}
void rpopCommand(redisClient *c) {
void rpopCommand(client *c) {
popGenericCommand(c,REDIS_TAIL);
}
void lrangeCommand(redisClient *c) {
void lrangeCommand(client *c) {
robj *o;
long start, end, llen, rangelen;
......@@ -432,7 +432,7 @@ void lrangeCommand(redisClient *c) {
}
}
void ltrimCommand(redisClient *c) {
void ltrimCommand(client *c) {
robj *o;
long start, end, llen, ltrim, rtrim;
......@@ -478,7 +478,7 @@ void ltrimCommand(redisClient *c) {
addReply(c,shared.ok);
}
void lremCommand(redisClient *c) {
void lremCommand(client *c) {
robj *subject, *obj;
obj = c->argv[3];
long toremove;
......@@ -533,7 +533,7 @@ void lremCommand(redisClient *c) {
* as well. This command was originally proposed by Ezra Zygmuntowicz.
*/
void rpoplpushHandlePush(redisClient *c, robj *dstkey, robj *dstobj, robj *value) {
void rpoplpushHandlePush(client *c, robj *dstkey, robj *dstobj, robj *value) {
/* Create the list if the key does not exist */
if (!dstobj) {
dstobj = createQuicklistObject();
......@@ -548,7 +548,7 @@ void rpoplpushHandlePush(redisClient *c, robj *dstkey, robj *dstobj, robj *value
addReplyBulk(c,value);
}
void rpoplpushCommand(redisClient *c) {
void rpoplpushCommand(client *c) {
robj *sobj, *value;
if ((sobj = lookupKeyWriteOrReply(c,c->argv[1],shared.nullbulk)) == NULL ||
checkType(c,sobj,REDIS_LIST)) return;
......@@ -608,7 +608,7 @@ void rpoplpushCommand(redisClient *c) {
/* Set a client in blocking mode for the specified key, with the specified
* timeout */
void blockForKeys(redisClient *c, robj **keys, int numkeys, mstime_t timeout, robj *target) {
void blockForKeys(client *c, robj **keys, int numkeys, mstime_t timeout, robj *target) {
dictEntry *de;
list *l;
int j;
......@@ -643,7 +643,7 @@ void blockForKeys(redisClient *c, robj **keys, int numkeys, mstime_t timeout, ro
/* Unblock a client that's waiting in a blocking operation such as BLPOP.
* You should never call this function directly, but unblockClient() instead. */
void unblockClientWaitingData(redisClient *c) {
void unblockClientWaitingData(client *c) {
dictEntry *de;
dictIterator *di;
list *l;
......@@ -721,7 +721,7 @@ void signalListAsReady(redisDb *db, robj *key) {
* should be undone as the client was not served: This only happens for
* BRPOPLPUSH that fails to push the value to the destination key as it is
* of the wrong type. */
int serveClientBlockedOnList(redisClient *receiver, robj *key, robj *dstkey, redisDb *db, robj *value, int where)
int serveClientBlockedOnList(client *receiver, robj *key, robj *dstkey, redisDb *db, robj *value, int where)
{
robj *argv[3];
......@@ -815,7 +815,7 @@ void handleClientsBlockedOnLists(void) {
while(numclients--) {
listNode *clientnode = listFirst(clients);
redisClient *receiver = clientnode->value;
client *receiver = clientnode->value;
robj *dstkey = receiver->bpop.target;
int where = (receiver->lastcmd &&
receiver->lastcmd->proc == blpopCommand) ?
......@@ -863,7 +863,7 @@ void handleClientsBlockedOnLists(void) {
}
/* Blocking RPOP/LPOP */
void blockingPopGenericCommand(redisClient *c, int where) {
void blockingPopGenericCommand(client *c, int where) {
robj *o;
mstime_t timeout;
int j;
......@@ -919,15 +919,15 @@ void blockingPopGenericCommand(redisClient *c, int where) {
blockForKeys(c, c->argv + 1, c->argc - 2, timeout, NULL);
}
void blpopCommand(redisClient *c) {
void blpopCommand(client *c) {
blockingPopGenericCommand(c,REDIS_HEAD);
}
void brpopCommand(redisClient *c) {
void brpopCommand(client *c) {
blockingPopGenericCommand(c,REDIS_TAIL);
}
void brpoplpushCommand(redisClient *c) {
void brpoplpushCommand(client *c) {
mstime_t timeout;
if (getTimeoutFromObjectOrReply(c,c->argv[3],&timeout,UNIT_SECONDS)
......
......@@ -33,7 +33,7 @@
* Set Commands
*----------------------------------------------------------------------------*/
void sunionDiffGenericCommand(redisClient *c, robj **setkeys, int setnum,
void sunionDiffGenericCommand(client *c, robj **setkeys, int setnum,
robj *dstkey, int op);
/* Factory method to return a set that *can* hold "value". When the object has
......@@ -269,7 +269,7 @@ void setTypeConvert(robj *setobj, int enc) {
}
}
void saddCommand(redisClient *c) {
void saddCommand(client *c) {
robj *set;
int j, added = 0;
......@@ -296,7 +296,7 @@ void saddCommand(redisClient *c) {
addReplyLongLong(c,added);
}
void sremCommand(redisClient *c) {
void sremCommand(client *c) {
robj *set;
int j, deleted = 0, keyremoved = 0;
......@@ -324,7 +324,7 @@ void sremCommand(redisClient *c) {
addReplyLongLong(c,deleted);
}
void smoveCommand(redisClient *c) {
void smoveCommand(client *c) {
robj *srcset, *dstset, *ele;
srcset = lookupKeyWrite(c->db,c->argv[1]);
dstset = lookupKeyWrite(c->db,c->argv[2]);
......@@ -377,7 +377,7 @@ void smoveCommand(redisClient *c) {
addReply(c,shared.cone);
}
void sismemberCommand(redisClient *c) {
void sismemberCommand(client *c) {
robj *set;
if ((set = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
......@@ -390,7 +390,7 @@ void sismemberCommand(redisClient *c) {
addReply(c,shared.czero);
}
void scardCommand(redisClient *c) {
void scardCommand(client *c) {
robj *o;
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
......@@ -407,7 +407,7 @@ void scardCommand(redisClient *c) {
* implementation for more info. */
#define SPOP_MOVE_STRATEGY_MUL 5
void spopWithCountCommand(redisClient *c) {
void spopWithCountCommand(client *c) {
long l;
unsigned long count, size;
robj *set;
......@@ -556,7 +556,7 @@ void spopWithCountCommand(redisClient *c) {
preventCommandPropagation(c);
}
void spopCommand(redisClient *c) {
void spopCommand(client *c) {
robj *set, *ele, *aux;
int64_t llele;
int encoding;
......@@ -616,7 +616,7 @@ void spopCommand(redisClient *c) {
* implementation for more info. */
#define SRANDMEMBER_SUB_STRATEGY_MUL 3
void srandmemberWithCountCommand(redisClient *c) {
void srandmemberWithCountCommand(client *c) {
long l;
unsigned long count, size;
int uniq = 1;
......@@ -749,7 +749,7 @@ void srandmemberWithCountCommand(redisClient *c) {
}
}
void srandmemberCommand(redisClient *c) {
void srandmemberCommand(client *c) {
robj *set, *ele;
int64_t llele;
int encoding;
......@@ -785,7 +785,7 @@ int qsortCompareSetsByRevCardinality(const void *s1, const void *s2) {
return (o2 ? setTypeSize(o2) : 0) - (o1 ? setTypeSize(o1) : 0);
}
void sinterGenericCommand(redisClient *c, robj **setkeys,
void sinterGenericCommand(client *c, robj **setkeys,
unsigned long setnum, robj *dstkey) {
robj **sets = zmalloc(sizeof(robj*)*setnum);
setTypeIterator *si;
......@@ -921,11 +921,11 @@ void sinterGenericCommand(redisClient *c, robj **setkeys,
zfree(sets);
}
void sinterCommand(redisClient *c) {
void sinterCommand(client *c) {
sinterGenericCommand(c,c->argv+1,c->argc-1,NULL);
}
void sinterstoreCommand(redisClient *c) {
void sinterstoreCommand(client *c) {
sinterGenericCommand(c,c->argv+2,c->argc-2,c->argv[1]);
}
......@@ -933,7 +933,7 @@ void sinterstoreCommand(redisClient *c) {
#define REDIS_OP_DIFF 1
#define REDIS_OP_INTER 2
void sunionDiffGenericCommand(redisClient *c, robj **setkeys, int setnum,
void sunionDiffGenericCommand(client *c, robj **setkeys, int setnum,
robj *dstkey, int op) {
robj **sets = zmalloc(sizeof(robj*)*setnum);
setTypeIterator *si;
......@@ -1092,23 +1092,23 @@ void sunionDiffGenericCommand(redisClient *c, robj **setkeys, int setnum,
zfree(sets);
}
void sunionCommand(redisClient *c) {
void sunionCommand(client *c) {
sunionDiffGenericCommand(c,c->argv+1,c->argc-1,NULL,REDIS_OP_UNION);
}
void sunionstoreCommand(redisClient *c) {
void sunionstoreCommand(client *c) {
sunionDiffGenericCommand(c,c->argv+2,c->argc-2,c->argv[1],REDIS_OP_UNION);
}
void sdiffCommand(redisClient *c) {
void sdiffCommand(client *c) {
sunionDiffGenericCommand(c,c->argv+1,c->argc-1,NULL,REDIS_OP_DIFF);
}
void sdiffstoreCommand(redisClient *c) {
void sdiffstoreCommand(client *c) {
sunionDiffGenericCommand(c,c->argv+2,c->argc-2,c->argv[1],REDIS_OP_DIFF);
}
void sscanCommand(redisClient *c) {
void sscanCommand(client *c) {
robj *set;
unsigned long cursor;
......
......@@ -34,7 +34,7 @@
* String Commands
*----------------------------------------------------------------------------*/
static int checkStringLength(redisClient *c, long long size) {
static int checkStringLength(client *c, long long size) {
if (size > 512*1024*1024) {
addReplyError(c,"string exceeds maximum allowed size (512MB)");
return REDIS_ERR;
......@@ -64,7 +64,7 @@ static int checkStringLength(redisClient *c, long long size) {
#define REDIS_SET_EX (1<<2) /* Set if time in seconds is given */
#define REDIS_SET_PX (1<<3) /* Set if time in ms in given */
void setGenericCommand(redisClient *c, int flags, robj *key, robj *val, robj *expire, int unit, robj *ok_reply, robj *abort_reply) {
void setGenericCommand(client *c, int flags, robj *key, robj *val, robj *expire, int unit, robj *ok_reply, robj *abort_reply) {
long long milliseconds = 0; /* initialized to avoid any harmness warning */
if (expire) {
......@@ -93,7 +93,7 @@ void setGenericCommand(redisClient *c, int flags, robj *key, robj *val, robj *ex
}
/* SET key value [NX] [XX] [EX <seconds>] [PX <milliseconds>] */
void setCommand(redisClient *c) {
void setCommand(client *c) {
int j;
robj *expire = NULL;
int unit = UNIT_SECONDS;
......@@ -139,22 +139,22 @@ void setCommand(redisClient *c) {
setGenericCommand(c,flags,c->argv[1],c->argv[2],expire,unit,NULL,NULL);
}
void setnxCommand(redisClient *c) {
void setnxCommand(client *c) {
c->argv[2] = tryObjectEncoding(c->argv[2]);
setGenericCommand(c,REDIS_SET_NX,c->argv[1],c->argv[2],NULL,0,shared.cone,shared.czero);
}
void setexCommand(redisClient *c) {
void setexCommand(client *c) {
c->argv[3] = tryObjectEncoding(c->argv[3]);
setGenericCommand(c,REDIS_SET_NO_FLAGS,c->argv[1],c->argv[3],c->argv[2],UNIT_SECONDS,NULL,NULL);
}
void psetexCommand(redisClient *c) {
void psetexCommand(client *c) {
c->argv[3] = tryObjectEncoding(c->argv[3]);
setGenericCommand(c,REDIS_SET_NO_FLAGS,c->argv[1],c->argv[3],c->argv[2],UNIT_MILLISECONDS,NULL,NULL);
}
int getGenericCommand(redisClient *c) {
int getGenericCommand(client *c) {
robj *o;
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk)) == NULL)
......@@ -169,11 +169,11 @@ int getGenericCommand(redisClient *c) {
}
}
void getCommand(redisClient *c) {
void getCommand(client *c) {
getGenericCommand(c);
}
void getsetCommand(redisClient *c) {
void getsetCommand(client *c) {
if (getGenericCommand(c) == REDIS_ERR) return;
c->argv[2] = tryObjectEncoding(c->argv[2]);
setKey(c->db,c->argv[1],c->argv[2]);
......@@ -181,7 +181,7 @@ void getsetCommand(redisClient *c) {
server.dirty++;
}
void setrangeCommand(redisClient *c) {
void setrangeCommand(client *c) {
robj *o;
long offset;
sds value = c->argv[3]->ptr;
......@@ -241,7 +241,7 @@ void setrangeCommand(redisClient *c) {
addReplyLongLong(c,sdslen(o->ptr));
}
void getrangeCommand(redisClient *c) {
void getrangeCommand(client *c) {
robj *o;
long long start, end;
char *str, llbuf[32];
......@@ -278,7 +278,7 @@ void getrangeCommand(redisClient *c) {
}
}
void mgetCommand(redisClient *c) {
void mgetCommand(client *c) {
int j;
addReplyMultiBulkLen(c,c->argc-1);
......@@ -296,7 +296,7 @@ void mgetCommand(redisClient *c) {
}
}
void msetGenericCommand(redisClient *c, int nx) {
void msetGenericCommand(client *c, int nx) {
int j, busykeys = 0;
if ((c->argc % 2) == 0) {
......@@ -326,15 +326,15 @@ void msetGenericCommand(redisClient *c, int nx) {
addReply(c, nx ? shared.cone : shared.ok);
}
void msetCommand(redisClient *c) {
void msetCommand(client *c) {
msetGenericCommand(c,0);
}
void msetnxCommand(redisClient *c) {
void msetnxCommand(client *c) {
msetGenericCommand(c,1);
}
void incrDecrCommand(redisClient *c, long long incr) {
void incrDecrCommand(client *c, long long incr) {
long long value, oldvalue;
robj *o, *new;
......@@ -372,29 +372,29 @@ void incrDecrCommand(redisClient *c, long long incr) {
addReply(c,shared.crlf);
}
void incrCommand(redisClient *c) {
void incrCommand(client *c) {
incrDecrCommand(c,1);
}
void decrCommand(redisClient *c) {
void decrCommand(client *c) {
incrDecrCommand(c,-1);
}
void incrbyCommand(redisClient *c) {
void incrbyCommand(client *c) {
long long incr;
if (getLongLongFromObjectOrReply(c, c->argv[2], &incr, NULL) != REDIS_OK) return;
incrDecrCommand(c,incr);
}
void decrbyCommand(redisClient *c) {
void decrbyCommand(client *c) {
long long incr;
if (getLongLongFromObjectOrReply(c, c->argv[2], &incr, NULL) != REDIS_OK) return;
incrDecrCommand(c,-incr);
}
void incrbyfloatCommand(redisClient *c) {
void incrbyfloatCommand(client *c) {
long double incr, value;
robj *o, *new, *aux;
......@@ -428,7 +428,7 @@ void incrbyfloatCommand(redisClient *c) {
rewriteClientCommandArgument(c,2,new);
}
void appendCommand(redisClient *c) {
void appendCommand(client *c) {
size_t totlen;
robj *o, *append;
......@@ -461,7 +461,7 @@ void appendCommand(redisClient *c) {
addReplyLongLong(c,totlen);
}
void strlenCommand(redisClient *c) {
void strlenCommand(client *c) {
robj *o;
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
checkType(c,o,REDIS_STRING)) return;
......
......@@ -1196,7 +1196,7 @@ int zsetScore(robj *zobj, robj *member, double *score) {
#define ZADD_NX (1<<1) /* Don't touch elements not already existing. */
#define ZADD_XX (1<<2) /* Only touch elements already exisitng. */
#define ZADD_CH (1<<3) /* Return num of elements added or updated. */
void zaddGenericCommand(redisClient *c, int flags) {
void zaddGenericCommand(client *c, int flags) {
static char *nanerr = "resulting score is not a number (NaN)";
robj *key = c->argv[1];
robj *ele;
......@@ -1388,15 +1388,15 @@ cleanup:
}
}
void zaddCommand(redisClient *c) {
void zaddCommand(client *c) {
zaddGenericCommand(c,ZADD_NONE);
}
void zincrbyCommand(redisClient *c) {
void zincrbyCommand(client *c) {
zaddGenericCommand(c,ZADD_INCR);
}
void zremCommand(redisClient *c) {
void zremCommand(client *c) {
robj *key = c->argv[1];
robj *zobj;
int deleted = 0, keyremoved = 0, j;
......@@ -1460,7 +1460,7 @@ void zremCommand(redisClient *c) {
#define ZRANGE_RANK 0
#define ZRANGE_SCORE 1
#define ZRANGE_LEX 2
void zremrangeGenericCommand(redisClient *c, int rangetype) {
void zremrangeGenericCommand(client *c, int rangetype) {
robj *key = c->argv[1];
robj *zobj;
int keyremoved = 0;
......@@ -1560,15 +1560,15 @@ cleanup:
if (rangetype == ZRANGE_LEX) zslFreeLexRange(&lexrange);
}
void zremrangebyrankCommand(redisClient *c) {
void zremrangebyrankCommand(client *c) {
zremrangeGenericCommand(c,ZRANGE_RANK);
}
void zremrangebyscoreCommand(redisClient *c) {
void zremrangebyscoreCommand(client *c) {
zremrangeGenericCommand(c,ZRANGE_SCORE);
}
void zremrangebylexCommand(redisClient *c) {
void zremrangebylexCommand(client *c) {
zremrangeGenericCommand(c,ZRANGE_LEX);
}
......@@ -1922,7 +1922,7 @@ inline static void zunionInterAggregate(double *target, double val, int aggregat
}
}
void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) {
void zunionInterGenericCommand(client *c, robj *dstkey, int op) {
int i, j;
long setnum;
int aggregate = REDIS_AGGR_SUM;
......@@ -2163,15 +2163,15 @@ void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) {
zfree(src);
}
void zunionstoreCommand(redisClient *c) {
void zunionstoreCommand(client *c) {
zunionInterGenericCommand(c,c->argv[1], REDIS_OP_UNION);
}
void zinterstoreCommand(redisClient *c) {
void zinterstoreCommand(client *c) {
zunionInterGenericCommand(c,c->argv[1], REDIS_OP_INTER);
}
void zrangeGenericCommand(redisClient *c, int reverse) {
void zrangeGenericCommand(client *c, int reverse) {
robj *key = c->argv[1];
robj *zobj;
int withscores = 0;
......@@ -2273,16 +2273,16 @@ void zrangeGenericCommand(redisClient *c, int reverse) {
}
}
void zrangeCommand(redisClient *c) {
void zrangeCommand(client *c) {
zrangeGenericCommand(c,0);
}
void zrevrangeCommand(redisClient *c) {
void zrevrangeCommand(client *c) {
zrangeGenericCommand(c,1);
}
/* This command implements ZRANGEBYSCORE, ZREVRANGEBYSCORE. */
void genericZrangebyscoreCommand(redisClient *c, int reverse) {
void genericZrangebyscoreCommand(client *c, int reverse) {
zrangespec range;
robj *key = c->argv[1];
robj *zobj;
......@@ -2468,15 +2468,15 @@ void genericZrangebyscoreCommand(redisClient *c, int reverse) {
setDeferredMultiBulkLength(c, replylen, rangelen);
}
void zrangebyscoreCommand(redisClient *c) {
void zrangebyscoreCommand(client *c) {
genericZrangebyscoreCommand(c,0);
}
void zrevrangebyscoreCommand(redisClient *c) {
void zrevrangebyscoreCommand(client *c) {
genericZrangebyscoreCommand(c,1);
}
void zcountCommand(redisClient *c) {
void zcountCommand(client *c) {
robj *key = c->argv[1];
robj *zobj;
zrangespec range;
......@@ -2553,7 +2553,7 @@ void zcountCommand(redisClient *c) {
addReplyLongLong(c, count);
}
void zlexcountCommand(redisClient *c) {
void zlexcountCommand(client *c) {
robj *key = c->argv[1];
robj *zobj;
zlexrangespec range;
......@@ -2633,7 +2633,7 @@ void zlexcountCommand(redisClient *c) {
}
/* This command implements ZRANGEBYLEX, ZREVRANGEBYLEX. */
void genericZrangebylexCommand(redisClient *c, int reverse) {
void genericZrangebylexCommand(client *c, int reverse) {
zlexrangespec range;
robj *key = c->argv[1];
robj *zobj;
......@@ -2809,15 +2809,15 @@ void genericZrangebylexCommand(redisClient *c, int reverse) {
setDeferredMultiBulkLength(c, replylen, rangelen);
}
void zrangebylexCommand(redisClient *c) {
void zrangebylexCommand(client *c) {
genericZrangebylexCommand(c,0);
}
void zrevrangebylexCommand(redisClient *c) {
void zrevrangebylexCommand(client *c) {
genericZrangebylexCommand(c,1);
}
void zcardCommand(redisClient *c) {
void zcardCommand(client *c) {
robj *key = c->argv[1];
robj *zobj;
......@@ -2827,7 +2827,7 @@ void zcardCommand(redisClient *c) {
addReplyLongLong(c,zsetLength(zobj));
}
void zscoreCommand(redisClient *c) {
void zscoreCommand(client *c) {
robj *key = c->argv[1];
robj *zobj;
double score;
......@@ -2842,7 +2842,7 @@ void zscoreCommand(redisClient *c) {
}
}
void zrankGenericCommand(redisClient *c, int reverse) {
void zrankGenericCommand(client *c, int reverse) {
robj *key = c->argv[1];
robj *ele = c->argv[2];
robj *zobj;
......@@ -2904,15 +2904,15 @@ void zrankGenericCommand(redisClient *c, int reverse) {
}
}
void zrankCommand(redisClient *c) {
void zrankCommand(client *c) {
zrankGenericCommand(c, 0);
}
void zrevrankCommand(redisClient *c) {
void zrevrankCommand(client *c) {
zrankGenericCommand(c, 1);
}
void zscanCommand(redisClient *c) {
void zscanCommand(client *c) {
robj *o;
unsigned long cursor;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment