diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/aof.c | 12 | ||||
-rw-r--r-- | src/bitops.c | 12 | ||||
-rw-r--r-- | src/blocked.c | 12 | ||||
-rw-r--r-- | src/cluster.c | 26 | ||||
-rw-r--r-- | src/cluster.h | 6 | ||||
-rw-r--r-- | src/config.c | 6 | ||||
-rw-r--r-- | src/db.c | 60 | ||||
-rw-r--r-- | src/debug.c | 8 | ||||
-rw-r--r-- | src/geo.c | 22 | ||||
-rw-r--r-- | src/hyperloglog.c | 12 | ||||
-rw-r--r-- | src/latency.c | 6 | ||||
-rw-r--r-- | src/multi.c | 30 | ||||
-rw-r--r-- | src/networking.c | 118 | ||||
-rw-r--r-- | src/object.c | 16 | ||||
-rw-r--r-- | src/pubsub.c | 28 | ||||
-rw-r--r-- | src/rdb.c | 8 | ||||
-rw-r--r-- | src/replication.c | 58 | ||||
-rw-r--r-- | src/scripting.c | 14 | ||||
-rw-r--r-- | src/sentinel.c | 28 | ||||
-rw-r--r-- | src/server.c | 36 | ||||
-rw-r--r-- | src/server.h | 484 | ||||
-rw-r--r-- | src/slowlog.c | 2 | ||||
-rw-r--r-- | src/slowlog.h | 2 | ||||
-rw-r--r-- | src/sort.c | 2 | ||||
-rw-r--r-- | src/t_hash.c | 38 | ||||
-rw-r--r-- | src/t_list.c | 52 | ||||
-rw-r--r-- | src/t_set.c | 38 | ||||
-rw-r--r-- | src/t_string.c | 46 | ||||
-rw-r--r-- | src/t_zset.c | 56 |
29 files changed, 619 insertions, 619 deletions
@@ -550,8 +550,8 @@ void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv, int a /* In Redis commands are always executed in the context of a client, so in * order to load the append only file we need to create a fake client. */ -struct redisClient *createFakeClient(void) { - struct redisClient *c = zmalloc(sizeof(*c)); +struct client *createFakeClient(void) { + struct client *c = zmalloc(sizeof(*c)); selectDb(c,0); c->fd = -1; @@ -577,7 +577,7 @@ struct redisClient *createFakeClient(void) { return c; } -void freeFakeClientArgv(struct redisClient *c) { +void freeFakeClientArgv(struct client *c) { int j; for (j = 0; j < c->argc; j++) @@ -585,7 +585,7 @@ void freeFakeClientArgv(struct redisClient *c) { zfree(c->argv); } -void freeFakeClient(struct redisClient *c) { +void freeFakeClient(struct client *c) { sdsfree(c->querybuf); listRelease(c->reply); listRelease(c->watched_keys); @@ -597,7 +597,7 @@ void freeFakeClient(struct redisClient *c) { * error (the append only file is zero-length) REDIS_ERR is returned. On * fatal error an error message is logged and the program exists. */ int loadAppendOnlyFile(char *filename) { - struct redisClient *fakeClient; + struct client *fakeClient; FILE *fp = fopen(filename,"r"); struct redis_stat sb; int old_aof_state = server.aof_state; @@ -1297,7 +1297,7 @@ int rewriteAppendOnlyFileBackground(void) { return REDIS_OK; /* unreached */ } -void bgrewriteaofCommand(redisClient *c) { +void bgrewriteaofCommand(client *c) { if (server.aof_child_pid != -1) { addReplyError(c,"Background append only file rewriting already in progress"); } else if (server.rdb_child_pid != -1) { diff --git a/src/bitops.c b/src/bitops.c index 6763bf1b0..66fa97ef5 100644 --- a/src/bitops.c +++ b/src/bitops.c @@ -37,7 +37,7 @@ /* This helper function used by GETBIT / SETBIT parses the bit offset argument * making sure an error is returned if it is negative or if it overflows * Redis 512 MB limit for the string value. */ -static int getBitOffsetFromArgument(redisClient *c, robj *o, size_t *offset) { +static int getBitOffsetFromArgument(client *c, robj *o, size_t *offset) { long long loffset; char *err = "bit offset is not an integer or out of range"; @@ -209,7 +209,7 @@ long redisBitpos(void *s, unsigned long count, int bit) { #define BITOP_NOT 3 /* SETBIT key offset bitvalue */ -void setbitCommand(redisClient *c) { +void setbitCommand(client *c) { robj *o; char *err = "bit is not an integer or out of range"; size_t bitoffset; @@ -256,7 +256,7 @@ void setbitCommand(redisClient *c) { } /* GETBIT key offset */ -void getbitCommand(redisClient *c) { +void getbitCommand(client *c) { robj *o; char llbuf[32]; size_t bitoffset; @@ -283,7 +283,7 @@ void getbitCommand(redisClient *c) { } /* BITOP op_name target_key src_key1 src_key2 src_key3 ... src_keyN */ -void bitopCommand(redisClient *c) { +void bitopCommand(client *c) { char *opname = c->argv[1]->ptr; robj *o, *targetkey = c->argv[2]; unsigned long op, j, numkeys; @@ -457,7 +457,7 @@ void bitopCommand(redisClient *c) { } /* BITCOUNT key [start end] */ -void bitcountCommand(redisClient *c) { +void bitcountCommand(client *c) { robj *o; long start, end, strlen; unsigned char *p; @@ -511,7 +511,7 @@ void bitcountCommand(redisClient *c) { } /* BITPOS key bit [start [end]] */ -void bitposCommand(redisClient *c) { +void bitposCommand(client *c) { robj *o; long bit, start, end, strlen; unsigned char *p; diff --git a/src/blocked.c b/src/blocked.c index 95b68fba1..d084521a3 100644 --- a/src/blocked.c +++ b/src/blocked.c @@ -73,7 +73,7 @@ * Note that if the timeout is zero (usually from the point of view of * commands API this means no timeout) the value stored into 'timeout' * is zero. */ -int getTimeoutFromObjectOrReply(redisClient *c, robj *object, mstime_t *timeout, int unit) { +int getTimeoutFromObjectOrReply(client *c, robj *object, mstime_t *timeout, int unit) { long long tval; if (getLongLongFromObjectOrReply(c,object,&tval, @@ -97,7 +97,7 @@ int getTimeoutFromObjectOrReply(redisClient *c, robj *object, mstime_t *timeout, /* Block a client for the specific operation type. Once the REDIS_BLOCKED * flag is set client query buffer is not longer processed, but accumulated, * and will be processed when the client is unblocked. */ -void blockClient(redisClient *c, int btype) { +void blockClient(client *c, int btype) { c->flags |= REDIS_BLOCKED; c->btype = btype; server.bpop_blocked_clients++; @@ -108,7 +108,7 @@ void blockClient(redisClient *c, int btype) { * unblocked after a blocking operation. */ void processUnblockedClients(void) { listNode *ln; - redisClient *c; + client *c; while (listLength(server.unblocked_clients)) { ln = listFirst(server.unblocked_clients); @@ -131,7 +131,7 @@ void processUnblockedClients(void) { /* Unblock a client calling the right function depending on the kind * of operation the client is blocking for. */ -void unblockClient(redisClient *c) { +void unblockClient(client *c) { if (c->btype == REDIS_BLOCKED_LIST) { unblockClientWaitingData(c); } else if (c->btype == REDIS_BLOCKED_WAIT) { @@ -154,7 +154,7 @@ void unblockClient(redisClient *c) { /* This function gets called when a blocked client timed out in order to * send it a reply of some kind. */ -void replyToBlockedClientTimedOut(redisClient *c) { +void replyToBlockedClientTimedOut(client *c) { if (c->btype == REDIS_BLOCKED_LIST) { addReply(c,shared.nullmultibulk); } else if (c->btype == REDIS_BLOCKED_WAIT) { @@ -177,7 +177,7 @@ void disconnectAllBlockedClients(void) { listRewind(server.clients,&li); while((ln = listNext(&li))) { - redisClient *c = listNodeValue(ln); + client *c = listNodeValue(ln); if (c->flags & REDIS_BLOCKED) { addReplySds(c,sdsnew( diff --git a/src/cluster.c b/src/cluster.c index 8fd5c9328..a294937c3 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -3722,7 +3722,7 @@ sds clusterGenNodesDescription(int filter) { * CLUSTER command * -------------------------------------------------------------------------- */ -int getSlotOrReply(redisClient *c, robj *o) { +int getSlotOrReply(client *c, robj *o) { long long slot; if (getLongLongFromObject(o,&slot) != REDIS_OK || @@ -3734,7 +3734,7 @@ int getSlotOrReply(redisClient *c, robj *o) { return (int) slot; } -void clusterReplyMultiBulkSlots(redisClient *c) { +void clusterReplyMultiBulkSlots(client *c) { /* Format: 1) 1) start slot * 2) end slot * 3) 1) master IP @@ -3804,7 +3804,7 @@ void clusterReplyMultiBulkSlots(redisClient *c) { setDeferredMultiBulkLength(c, slot_replylen, num_masters); } -void clusterCommand(redisClient *c) { +void clusterCommand(client *c) { if (server.cluster_enabled == 0) { addReplyError(c,"This instance has cluster support disabled"); return; @@ -4363,7 +4363,7 @@ int verifyDumpPayload(unsigned char *p, size_t len) { /* DUMP keyname * DUMP is actually not used by Redis Cluster but it is the obvious * complement of RESTORE and can be useful for different applications. */ -void dumpCommand(redisClient *c) { +void dumpCommand(client *c) { robj *o, *dumpobj; rio payload; @@ -4384,7 +4384,7 @@ void dumpCommand(redisClient *c) { } /* RESTORE key ttl serialized-value [REPLACE] */ -void restoreCommand(redisClient *c) { +void restoreCommand(client *c) { long long ttl; rio payload; int j, type, replace = 0; @@ -4466,7 +4466,7 @@ typedef struct migrateCachedSocket { * If the caller detects an error while using the socket, migrateCloseSocket() * should be called so that the connection will be created from scratch * the next time. */ -migrateCachedSocket* migrateGetSocket(redisClient *c, robj *host, robj *port, long timeout) { +migrateCachedSocket* migrateGetSocket(client *c, robj *host, robj *port, long timeout) { int fd; sds name = sdsempty(); migrateCachedSocket *cs; @@ -4558,7 +4558,7 @@ void migrateCloseTimedoutSockets(void) { } /* MIGRATE host port key dbid timeout [COPY | REPLACE] */ -void migrateCommand(redisClient *c) { +void migrateCommand(client *c) { migrateCachedSocket *cs; int copy, replace, j; long timeout; @@ -4723,7 +4723,7 @@ socket_rd_err: * The client should issue ASKING before to actually send the command to * the target instance. See the Redis Cluster specification for more * information. */ -void askingCommand(redisClient *c) { +void askingCommand(client *c) { if (server.cluster_enabled == 0) { addReplyError(c,"This instance has cluster support disabled"); return; @@ -4735,7 +4735,7 @@ void askingCommand(redisClient *c) { /* The READONLY command is used by clients to enter the read-only mode. * In this mode slaves will not redirect clients as long as clients access * with read-only commands to keys that are served by the slave's master. */ -void readonlyCommand(redisClient *c) { +void readonlyCommand(client *c) { if (server.cluster_enabled == 0) { addReplyError(c,"This instance has cluster support disabled"); return; @@ -4745,7 +4745,7 @@ void readonlyCommand(redisClient *c) { } /* The READWRITE command just clears the READONLY command state. */ -void readwriteCommand(redisClient *c) { +void readwriteCommand(client *c) { c->flags &= ~REDIS_READONLY; addReply(c,shared.ok); } @@ -4779,7 +4779,7 @@ void readwriteCommand(redisClient *c) { * not bound to any node. In this case the cluster global state should be * already "down" but it is fragile to rely on the update of the global state, * so we also handle it here. */ -clusterNode *getNodeByQuery(redisClient *c, struct redisCommand *cmd, robj **argv, int argc, int *hashslot, int *error_code) { +clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, int argc, int *hashslot, int *error_code) { clusterNode *n = NULL; robj *firstkey = NULL; int multiple_keys = 0; @@ -4940,7 +4940,7 @@ clusterNode *getNodeByQuery(redisClient *c, struct redisCommand *cmd, robj **arg * are used, then the node 'n' should not be NULL, but should be the * node we want to mention in the redirection. Moreover hashslot should * be set to the hash slot that caused the redirection. */ -void clusterRedirectClient(redisClient *c, clusterNode *n, int hashslot, int error_code) { +void clusterRedirectClient(client *c, clusterNode *n, int hashslot, int error_code) { if (error_code == REDIS_CLUSTER_REDIR_CROSS_SLOT) { addReplySds(c,sdsnew("-CROSSSLOT Keys in request don't hash to the same slot\r\n")); } else if (error_code == REDIS_CLUSTER_REDIR_UNSTABLE) { @@ -4975,7 +4975,7 @@ void clusterRedirectClient(redisClient *c, clusterNode *n, int hashslot, int err * If the client is found to be blocked into an hash slot this node no * longer handles, the client is sent a redirection error, and the function * returns 1. Otherwise 0 is returned and no operation is performed. */ -int clusterRedirectBlockedClientIfNeeded(redisClient *c) { +int clusterRedirectBlockedClientIfNeeded(client *c) { if (c->flags & REDIS_BLOCKED && c->btype == REDIS_BLOCKED_LIST) { dictEntry *de; dictIterator *di; diff --git a/src/cluster.h b/src/cluster.h index bf442a222..a6c7e4462 100644 --- a/src/cluster.h +++ b/src/cluster.h @@ -249,8 +249,8 @@ typedef struct { master is up. */ /* ---------------------- API exported outside cluster.c -------------------- */ -clusterNode *getNodeByQuery(redisClient *c, struct redisCommand *cmd, robj **argv, int argc, int *hashslot, int *ask); -int clusterRedirectBlockedClientIfNeeded(redisClient *c); -void clusterRedirectClient(redisClient *c, clusterNode *n, int hashslot, int error_code); +clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, int argc, int *hashslot, int *ask); +int clusterRedirectBlockedClientIfNeeded(client *c); +void clusterRedirectClient(client *c, clusterNode *n, int hashslot, int error_code); #endif /* __REDIS_CLUSTER_H */ diff --git a/src/config.c b/src/config.c index 0659ee2fc..167ea6fd7 100644 --- a/src/config.c +++ b/src/config.c @@ -699,7 +699,7 @@ void loadServerConfig(char *filename, char *options) { #define config_set_else } else -void configSetCommand(redisClient *c) { +void configSetCommand(client *c) { robj *o; long long ll; int err; @@ -1024,7 +1024,7 @@ badfmt: /* Bad format errors */ } \ } while(0); -void configGetCommand(redisClient *c) { +void configGetCommand(client *c) { robj *o = c->argv[2]; void *replylen = addDeferredMultiBulkLength(c); char *pattern = o->ptr; @@ -1843,7 +1843,7 @@ int rewriteConfig(char *path) { * CONFIG command entry point *----------------------------------------------------------------------------*/ -void configCommand(redisClient *c) { +void configCommand(client *c) { if (!strcasecmp(c->argv[1]->ptr,"set")) { if (c->argc != 4) goto badarity; configSetCommand(c); @@ -99,13 +99,13 @@ robj *lookupKeyWrite(redisDb *db, robj *key) { return lookupKey(db,key); } -robj *lookupKeyReadOrReply(redisClient *c, robj *key, robj *reply) { +robj *lookupKeyReadOrReply(client *c, robj *key, robj *reply) { robj *o = lookupKeyRead(c->db, key); if (!o) addReply(c,reply); return o; } -robj *lookupKeyWriteOrReply(redisClient *c, robj *key, robj *reply) { +robj *lookupKeyWriteOrReply(client *c, robj *key, robj *reply) { robj *o = lookupKeyWrite(c->db, key); if (!o) addReply(c,reply); return o; @@ -247,7 +247,7 @@ long long emptyDb(void(callback)(void*)) { return removed; } -int selectDb(redisClient *c, int id) { +int selectDb(client *c, int id) { if (id < 0 || id >= server.dbnum) return REDIS_ERR; c->db = &server.db[id]; @@ -275,7 +275,7 @@ void signalFlushedDb(int dbid) { * Type agnostic commands operating on the key space *----------------------------------------------------------------------------*/ -void flushdbCommand(redisClient *c) { +void flushdbCommand(client *c) { server.dirty += dictSize(c->db->dict); signalFlushedDb(c->db->id); dictEmpty(c->db->dict,NULL); @@ -284,7 +284,7 @@ void flushdbCommand(redisClient *c) { addReply(c,shared.ok); } -void flushallCommand(redisClient *c) { +void flushallCommand(client *c) { signalFlushedDb(-1); server.dirty += emptyDb(NULL); addReply(c,shared.ok); @@ -302,7 +302,7 @@ void flushallCommand(redisClient *c) { server.dirty++; } -void delCommand(redisClient *c) { +void delCommand(client *c) { int deleted = 0, j; for (j = 1; j < c->argc; j++) { @@ -320,7 +320,7 @@ void delCommand(redisClient *c) { /* EXISTS key1 key2 ... key_N. * Return value is the number of keys existing. */ -void existsCommand(redisClient *c) { +void existsCommand(client *c) { long long count = 0; int j; @@ -331,7 +331,7 @@ void existsCommand(redisClient *c) { addReplyLongLong(c,count); } -void selectCommand(redisClient *c) { +void selectCommand(client *c) { long id; if (getLongFromObjectOrReply(c, c->argv[1], &id, @@ -349,7 +349,7 @@ void selectCommand(redisClient *c) { } } -void randomkeyCommand(redisClient *c) { +void randomkeyCommand(client *c) { robj *key; if ((key = dbRandomKey(c->db)) == NULL) { @@ -361,7 +361,7 @@ void randomkeyCommand(redisClient *c) { decrRefCount(key); } -void keysCommand(redisClient *c) { +void keysCommand(client *c) { dictIterator *di; dictEntry *de; sds pattern = c->argv[1]->ptr; @@ -423,7 +423,7 @@ void scanCallback(void *privdata, const dictEntry *de) { * if the cursor is valid, store it as unsigned integer into *cursor and * returns REDIS_OK. Otherwise return REDIS_ERR and send an error to the * client. */ -int parseScanCursorOrReply(redisClient *c, robj *o, unsigned long *cursor) { +int parseScanCursorOrReply(client *c, robj *o, unsigned long *cursor) { char *eptr; /* Use strtoul() because we need an *unsigned* long, so @@ -449,7 +449,7 @@ int parseScanCursorOrReply(redisClient *c, robj *o, unsigned long *cursor) { * * In the case of a Hash object the function returns both the field and value * of every element on the Hash. */ -void scanGenericCommand(redisClient *c, robj *o, unsigned long cursor) { +void scanGenericCommand(client *c, robj *o, unsigned long cursor) { int i, j; list *keys = listCreate(); listNode *node, *nextnode; @@ -627,21 +627,21 @@ cleanup: } /* The SCAN command completely relies on scanGenericCommand. */ -void scanCommand(redisClient *c) { +void scanCommand(client *c) { unsigned long cursor; if (parseScanCursorOrReply(c,c->argv[1],&cursor) == REDIS_ERR) return; scanGenericCommand(c,NULL,cursor); } -void dbsizeCommand(redisClient *c) { +void dbsizeCommand(client *c) { addReplyLongLong(c,dictSize(c->db->dict)); } -void lastsaveCommand(redisClient *c) { +void lastsaveCommand(client *c) { addReplyLongLong(c,server.lastsave); } -void typeCommand(redisClient *c) { +void typeCommand(client *c) { robj *o; char *type; @@ -661,7 +661,7 @@ void typeCommand(redisClient *c) { addReplyStatus(c,type); } -void shutdownCommand(redisClient *c) { +void shutdownCommand(client *c) { int flags = 0; if (c->argc > 2) { @@ -689,7 +689,7 @@ void shutdownCommand(redisClient *c) { addReplyError(c,"Errors trying to SHUTDOWN. Check logs."); } -void renameGenericCommand(redisClient *c, int nx) { +void renameGenericCommand(client *c, int nx) { robj *o; long long expire; int samekey = 0; @@ -731,15 +731,15 @@ void renameGenericCommand(redisClient *c, int nx) { addReply(c,nx ? shared.cone : shared.ok); } -void renameCommand(redisClient *c) { +void renameCommand(client *c) { renameGenericCommand(c,0); } -void renamenxCommand(redisClient *c) { +void renamenxCommand(client *c) { renameGenericCommand(c,1); } -void moveCommand(redisClient *c) { +void moveCommand(client *c) { robj *o; redisDb *src, *dst; int srcid; @@ -899,7 +899,7 @@ int expireIfNeeded(redisDb *db, robj *key) { * * unit is either UNIT_SECONDS or UNIT_MILLISECONDS, and is only used for * the argv[2] parameter. The basetime is always specified in milliseconds. */ -void expireGenericCommand(redisClient *c, long long basetime, int unit) { +void expireGenericCommand(client *c, long long basetime, int unit) { robj *key = c->argv[1], *param = c->argv[2]; long long when; /* unix time in milliseconds when the key will expire. */ @@ -945,23 +945,23 @@ void expireGenericCommand(redisClient *c, long long basetime, int unit) { } } -void expireCommand(redisClient *c) { +void expireCommand(client *c) { expireGenericCommand(c,mstime(),UNIT_SECONDS); } -void expireatCommand(redisClient *c) { +void expireatCommand(client *c) { expireGenericCommand(c,0,UNIT_SECONDS); } -void pexpireCommand(redisClient *c) { +void pexpireCommand(client *c) { expireGenericCommand(c,mstime(),UNIT_MILLISECONDS); } -void pexpireatCommand(redisClient *c) { +void pexpireatCommand(client *c) { expireGenericCommand(c,0,UNIT_MILLISECONDS); } -void ttlGenericCommand(redisClient *c, int output_ms) { +void ttlGenericCommand(client *c, int output_ms) { long long expire, ttl = -1; /* If the key does not exist at all, return -2 */ @@ -983,15 +983,15 @@ void ttlGenericCommand(redisClient *c, int output_ms) { } } -void ttlCommand(redisClient *c) { +void ttlCommand(client *c) { ttlGenericCommand(c, 0); } -void pttlCommand(redisClient *c) { +void pttlCommand(client *c) { ttlGenericCommand(c, 1); } -void persistCommand(redisClient *c) { +void persistCommand(client *c) { dictEntry *de; de = dictFind(c->db->dict,c->argv[1]->ptr); diff --git a/src/debug.c b/src/debug.c index 9c9118eb2..1e87300eb 100644 --- a/src/debug.c +++ b/src/debug.c @@ -258,7 +258,7 @@ void inputCatSds(void *result, const char *str) { *info = sdscat(*info, str); } -void debugCommand(redisClient *c) { +void debugCommand(client *c) { if (!strcasecmp(c->argv[1]->ptr,"segfault")) { *((char*)-1) = 'x'; } else if (!strcasecmp(c->argv[1]->ptr,"oom")) { @@ -483,7 +483,7 @@ void _redisAssert(char *estr, char *file, int line) { *((char*)-1) = 'x'; } -void _redisAssertPrintClientInfo(redisClient *c) { +void _redisAssertPrintClientInfo(client *c) { int j; bugReportStart(); @@ -537,7 +537,7 @@ void _redisAssertPrintObject(robj *o) { serverLogObjectDebugInfo(o); } -void _redisAssertWithInfo(redisClient *c, robj *o, char *estr, char *file, int line) { +void _redisAssertWithInfo(client *c, robj *o, char *estr, char *file, int line) { if (c) _redisAssertPrintClientInfo(c); if (o) _redisAssertPrintObject(o); _redisAssert(estr,file,line); @@ -770,7 +770,7 @@ void logStackTrace(ucontext_t *uc) { void logCurrentClient(void) { if (server.current_client == NULL) return; - redisClient *cc = server.current_client; + client *cc = server.current_client; sds client; int j; @@ -89,7 +89,7 @@ int decodeGeohash(double bits, double *xy) { /* Input Argument Helper */ /* Take a pointer to the latitude arg then use the next arg for longitude. * On parse error REDIS_ERR is returned, otherwise REDIS_OK. */ -int extractLongLatOrReply(redisClient *c, robj **argv, +int extractLongLatOrReply(client *c, robj **argv, double *xy) { for (int i = 0; i < 2; i++) { if (getDoubleFromObjectOrReply(c, argv[i], xy + i, NULL) != @@ -123,7 +123,7 @@ int longLatFromMember(robj *zobj, robj *member, double *xy) { * * If the unit is not valid, an error is reported to the client, and a value * less than zero is returned. */ -double extractUnitOrReply(redisClient *c, robj *unit) { +double extractUnitOrReply(client *c, robj *unit) { char *u = unit->ptr; if (!strcmp(u, "m")) { @@ -148,7 +148,7 @@ double extractUnitOrReply(redisClient *c, robj *unit) { * to use in order to convert meters to the unit. * * On error a value less than zero is returned. */ -double extractDistanceOrReply(redisClient *c, robj **argv, +double extractDistanceOrReply(client *c, robj **argv, double *conversion) { double distance; if (getDoubleFromObjectOrReply(c, argv[0], &distance, @@ -168,7 +168,7 @@ double extractDistanceOrReply(redisClient *c, robj **argv, * than "5.2144992818115 meters away." We provide 4 digits after the dot * so that the returned value is decently accurate even when the unit is * the kilometer. */ -void addReplyDoubleDistance(redisClient *c, double d) { +void addReplyDoubleDistance(client *c, double d) { char dbuf[128]; int dlen = snprintf(dbuf, sizeof(dbuf), "%.4f", d); addReplyBulkCBuffer(c, dbuf, dlen); @@ -363,7 +363,7 @@ static int sort_gp_desc(const void *a, const void *b) { * ==================================================================== */ /* GEOADD key long lat name [long2 lat2 name2 ... longN latN nameN] */ -void geoaddCommand(redisClient *c) { +void geoaddCommand(client *c) { /* Check arguments number for sanity. */ if ((c->argc - 2) % 3 != 0) { /* Need an odd number of arguments if we got this far... */ @@ -419,7 +419,7 @@ void geoaddCommand(redisClient *c) { /* GEORADIUS key x y radius unit [WITHDIST] [WITHHASH] [WITHCOORD] [ASC|DESC] * [COUNT count] * GEORADIUSBYMEMBER key member radius unit ... options ... */ -void georadiusGeneric(redisClient *c, int type) { +void georadiusGeneric(client *c, int type) { robj *key = c->argv[1]; /* Look up the requested zset */ @@ -569,12 +569,12 @@ void georadiusGeneric(redisClient *c, int type) { } /* GEORADIUS wrapper function. */ -void georadiusCommand(redisClient *c) { +void georadiusCommand(client *c) { georadiusGeneric(c, RADIUS_COORDS); } /* GEORADIUSBYMEMBER wrapper function. */ -void georadiusByMemberCommand(redisClient *c) { +void georadiusByMemberCommand(client *c) { georadiusGeneric(c, RADIUS_MEMBER); } @@ -582,7 +582,7 @@ void georadiusByMemberCommand(redisClient *c) { * * Returns an array with an 11 characters geohash representation of the * position of the specified elements. */ -void geohashCommand(redisClient *c) { +void geohashCommand(client *c) { char *geoalphabet= "0123456789bcdefghjkmnpqrstuvwxyz"; int j; @@ -637,7 +637,7 @@ void geohashCommand(redisClient *c) { * * Returns an array of two-items arrays representing the x,y position of each * element specified in the arguments. For missing elements NULL is returned. */ -void geoposCommand(redisClient *c) { +void geoposCommand(client *c) { int j; /* Look up the requested zset */ @@ -671,7 +671,7 @@ void geoposCommand(redisClient *c) { * Return the distance, in meters by default, otherwise accordig to "unit", * between points ele1 and ele2. If one or more elements are missing NULL * is returned. */ -void geodistCommand(redisClient *c) { +void geodistCommand(client *c) { double to_meter = 1; /* Check if there is the unit to extract, otherwise assume meters. */ diff --git a/src/hyperloglog.c b/src/hyperloglog.c index 74e7b8fc6..6405f5ba9 100644 --- a/src/hyperloglog.c +++ b/src/hyperloglog.c @@ -1121,7 +1121,7 @@ robj *createHLLObject(void) { /* Check if the object is a String with a valid HLL representation. * Return REDIS_OK if this is true, otherwise reply to the client * with an error and return REDIS_ERR. */ -int isHLLObjectOrReply(redisClient *c, robj *o) { +int isHLLObjectOrReply(client *c, robj *o) { struct hllhdr *hdr; /* Key exists, check type */ @@ -1152,7 +1152,7 @@ invalid: } /* PFADD var ele ele ele ... ele => :0 or :1 */ -void pfaddCommand(redisClient *c) { +void pfaddCommand(client *c) { robj *o = lookupKeyWrite(c->db,c->argv[1]); struct hllhdr *hdr; int updated = 0, j; @@ -1192,7 +1192,7 @@ void pfaddCommand(redisClient *c) { } /* PFCOUNT var -> approximated cardinality of set. */ -void pfcountCommand(redisClient *c) { +void pfcountCommand(client *c) { robj *o; struct hllhdr *hdr; uint64_t card; @@ -1282,7 +1282,7 @@ void pfcountCommand(redisClient *c) { } /* PFMERGE dest src1 src2 src3 ... srcN => OK */ -void pfmergeCommand(redisClient *c) { +void pfmergeCommand(client *c) { uint8_t max[HLL_REGISTERS]; struct hllhdr *hdr; int j; @@ -1348,7 +1348,7 @@ void pfmergeCommand(redisClient *c) { * This command performs a self-test of the HLL registers implementation. * Something that is not easy to test from within the outside. */ #define HLL_TEST_CYCLES 1000 -void pfselftestCommand(redisClient *c) { +void pfselftestCommand(client *c) { unsigned int j, i; sds bitcounters = sdsnewlen(NULL,HLL_DENSE_SIZE); struct hllhdr *hdr = (struct hllhdr*) bitcounters, *hdr2; @@ -1452,7 +1452,7 @@ cleanup: /* PFDEBUG <subcommand> <key> ... args ... * Different debugging related operations about the HLL implementation. */ -void pfdebugCommand(redisClient *c) { +void pfdebugCommand(client *c) { char *cmd = c->argv[1]->ptr; struct hllhdr *hdr; robj *o; diff --git a/src/latency.c b/src/latency.c index d6261f603..49a01f590 100644 --- a/src/latency.c +++ b/src/latency.c @@ -474,7 +474,7 @@ sds createLatencyReport(void) { /* latencyCommand() helper to produce a time-delay reply for all the samples * in memory for the specified time series. */ -void latencyCommandReplyWithSamples(redisClient *c, struct latencyTimeSeries *ts) { +void latencyCommandReplyWithSamples(client *c, struct latencyTimeSeries *ts) { void *replylen = addDeferredMultiBulkLength(c); int samples = 0, j; @@ -492,7 +492,7 @@ void latencyCommandReplyWithSamples(redisClient *c, struct latencyTimeSeries *ts /* latencyCommand() helper to produce the reply for the LATEST subcommand, * listing the last latency sample for every event type registered so far. */ -void latencyCommandReplyWithLatestEvents(redisClient *c) { +void latencyCommandReplyWithLatestEvents(client *c) { dictIterator *di; dictEntry *de; @@ -564,7 +564,7 @@ sds latencyCommandGenSparkeline(char *event, struct latencyTimeSeries *ts) { * LATENCY DOCTOR: returns an human readable analysis of instance latency. * LATENCY GRAPH: provide an ASCII graph of the latency of the specified event. */ -void latencyCommand(redisClient *c) { +void latencyCommand(client *c) { struct latencyTimeSeries *ts; if (!strcasecmp(c->argv[1]->ptr,"history") && c->argc == 3) { diff --git a/src/multi.c b/src/multi.c index 313fccd04..aff394023 100644 --- a/src/multi.c +++ b/src/multi.c @@ -32,13 +32,13 @@ /* ================================ MULTI/EXEC ============================== */ /* Client state initialization for MULTI/EXEC */ -void initClientMultiState(redisClient *c) { +void initClientMultiState(client *c) { c->mstate.commands = NULL; c->mstate.count = 0; } /* Release all the resources associated with MULTI/EXEC state */ -void freeClientMultiState(redisClient *c) { +void freeClientMultiState(client *c) { int j; for (j = 0; j < c->mstate.count; j++) { @@ -53,7 +53,7 @@ void freeClientMultiState(redisClient *c) { } /* Add a new command into the MULTI commands queue */ -void queueMultiCommand(redisClient *c) { +void queueMultiCommand(client *c) { multiCmd *mc; int j; @@ -69,7 +69,7 @@ void queueMultiCommand(redisClient *c) { c->mstate.count++; } -void discardTransaction(redisClient *c) { +void discardTransaction(client *c) { freeClientMultiState(c); initClientMultiState(c); c->flags &= ~(REDIS_MULTI|REDIS_DIRTY_CAS|REDIS_DIRTY_EXEC); @@ -78,12 +78,12 @@ void discardTransaction(redisClient *c) { /* Flag the transacation as DIRTY_EXEC so that EXEC will fail. * Should be called every time there is an error while queueing a command. */ -void flagTransaction(redisClient *c) { +void flagTransaction(client *c) { if (c->flags & REDIS_MULTI) c->flags |= REDIS_DIRTY_EXEC; } -void multiCommand(redisClient *c) { +void multiCommand(client *c) { if (c->flags & REDIS_MULTI) { addReplyError(c,"MULTI calls can not be nested"); return; @@ -92,7 +92,7 @@ void multiCommand(redisClient *c) { addReply(c,shared.ok); } -void discardCommand(redisClient *c) { +void discardCommand(client *c) { if (!(c->flags & REDIS_MULTI)) { addReplyError(c,"DISCARD without MULTI"); return; @@ -103,7 +103,7 @@ void discardCommand(redisClient *c) { /* Send a MULTI command to all the slaves and AOF file. Check the execCommand * implementation for more information. */ -void execCommandPropagateMulti(redisClient *c) { +void execCommandPropagateMulti(client *c) { robj *multistring = createStringObject("MULTI",5); propagate(server.multiCommand,c->db->id,&multistring,1, @@ -111,7 +111,7 @@ void execCommandPropagateMulti(redisClient *c) { decrRefCount(multistring); } -void execCommand(redisClient *c) { +void execCommand(client *c) { int j; robj **orig_argv; int orig_argc; @@ -199,7 +199,7 @@ typedef struct watchedKey { } watchedKey; /* Watch for the specified key */ -void watchForKey(redisClient *c, robj *key) { +void watchForKey(client *c, robj *key) { list *clients = NULL; listIter li; listNode *ln; @@ -230,7 +230,7 @@ void watchForKey(redisClient *c, robj *key) { /* Unwatch all the keys watched by this client. To clean the EXEC dirty * flag is up to the caller. */ -void unwatchAllKeys(redisClient *c) { +void unwatchAllKeys(client *c) { listIter li; listNode *ln; @@ -271,7 +271,7 @@ void touchWatchedKey(redisDb *db, robj *key) { /* Check if we are already watching for this key */ listRewind(clients,&li); while((ln = listNext(&li))) { - redisClient *c = listNodeValue(ln); + client *c = listNodeValue(ln); c->flags |= REDIS_DIRTY_CAS; } @@ -288,7 +288,7 @@ void touchWatchedKeysOnFlush(int dbid) { /* For every client, check all the waited keys */ listRewind(server.clients,&li1); while((ln = listNext(&li1))) { - redisClient *c = listNodeValue(ln); + client *c = listNodeValue(ln); listRewind(c->watched_keys,&li2); while((ln = listNext(&li2))) { watchedKey *wk = listNodeValue(ln); @@ -304,7 +304,7 @@ void touchWatchedKeysOnFlush(int dbid) { } } -void watchCommand(redisClient *c) { +void watchCommand(client *c) { int j; if (c->flags & REDIS_MULTI) { @@ -316,7 +316,7 @@ void watchCommand(redisClient *c) { addReply(c,shared.ok); } -void unwatchCommand(redisClient *c) { +void unwatchCommand(client *c) { unwatchAllKeys(c); c->flags &= (~REDIS_DIRTY_CAS); addReply(c,shared.ok); diff --git a/src/networking.c b/src/networking.c index ec9aef2bc..277c400fc 100644 --- a/src/networking.c +++ b/src/networking.c @@ -31,7 +31,7 @@ #include <sys/uio.h> #include <math.h> -static void setProtocolError(redisClient *c, int pos); +static void setProtocolError(client *c, int pos); /* Return the size consumed from the allocator, for the specified SDS string, * including internal fragmentation. This function is used in order to compute @@ -61,8 +61,8 @@ int listMatchObjects(void *a, void *b) { return equalStringObjects(a,b); } -redisClient *createClient(int fd) { - redisClient *c = zmalloc(sizeof(redisClient)); +client *createClient(int fd) { + client *c = zmalloc(sizeof(client)); /* passing -1 as fd it is possible to create a non connected client. * This is useful since all the Redis commands needs to be executed @@ -150,7 +150,7 @@ redisClient *createClient(int fd) { * Typically gets called every time a reply is built, before adding more * data to the clients output buffers. If the function returns REDIS_ERR no * data should be appended to the output buffers. */ -int prepareClientToWrite(redisClient *c) { +int prepareClientToWrite(client *c) { /* If it's the Lua client we always return ok without installing any * handler since there is no socket at all. */ if (c->flags & REDIS_LUA_CLIENT) return REDIS_OK; @@ -201,7 +201,7 @@ robj *dupLastObjectIfNeeded(list *reply) { * Low level functions to add more data to output buffers. * -------------------------------------------------------------------------- */ -int _addReplyToBuffer(redisClient *c, const char *s, size_t len) { +int _addReplyToBuffer(client *c, const char *s, size_t len) { size_t available = sizeof(c->buf)-c->bufpos; if (c->flags & REDIS_CLOSE_AFTER_REPLY) return REDIS_OK; @@ -218,7 +218,7 @@ int _addReplyToBuffer(redisClient *c, const char *s, size_t len) { return REDIS_OK; } -void _addReplyObjectToList(redisClient *c, robj *o) { +void _addReplyObjectToList(client *c, robj *o) { robj *tail; if (c->flags & REDIS_CLOSE_AFTER_REPLY) return; @@ -250,7 +250,7 @@ void _addReplyObjectToList(redisClient *c, robj *o) { /* This method takes responsibility over the sds. When it is no longer * needed it will be free'd, otherwise it ends up in a robj. */ -void _addReplySdsToList(redisClient *c, sds s) { +void _addReplySdsToList(client *c, sds s) { robj *tail; if (c->flags & REDIS_CLOSE_AFTER_REPLY) { @@ -281,7 +281,7 @@ void _addReplySdsToList(redisClient *c, sds s) { asyncCloseClientOnOutputBufferLimitReached(c); } -void _addReplyStringToList(redisClient *c, const char *s, size_t len) { +void _addReplyStringToList(client *c, const char *s, size_t len) { robj *tail; if (c->flags & REDIS_CLOSE_AFTER_REPLY) return; @@ -317,7 +317,7 @@ void _addReplyStringToList(redisClient *c, const char *s, size_t len) { * The following functions are the ones that commands implementations will call. * -------------------------------------------------------------------------- */ -void addReply(redisClient *c, robj *obj) { +void addReply(client *c, robj *obj) { if (prepareClientToWrite(c) != REDIS_OK) return; /* This is an important place where we can avoid copy-on-write @@ -353,7 +353,7 @@ void addReply(redisClient *c, robj *obj) { } } -void addReplySds(redisClient *c, sds s) { +void addReplySds(client *c, sds s) { if (prepareClientToWrite(c) != REDIS_OK) { /* The caller expects the sds to be free'd. */ sdsfree(s); @@ -367,23 +367,23 @@ void addReplySds(redisClient *c, sds s) { } } -void addReplyString(redisClient *c, const char *s, size_t len) { +void addReplyString(client *c, const char *s, size_t len) { if (prepareClientToWrite(c) != REDIS_OK) return; if (_addReplyToBuffer(c,s,len) != REDIS_OK) _addReplyStringToList(c,s,len); } -void addReplyErrorLength(redisClient *c, const char *s, size_t len) { +void addReplyErrorLength(client *c, const char *s, size_t len) { addReplyString(c,"-ERR ",5); addReplyString(c,s,len); addReplyString(c,"\r\n",2); } -void addReplyError(redisClient *c, const char *err) { +void addReplyError(client *c, const char *err) { addReplyErrorLength(c,err,strlen(err)); } -void addReplyErrorFormat(redisClient *c, const char *fmt, ...) { +void addReplyErrorFormat(client *c, const char *fmt, ...) { size_t l, j; va_list ap; va_start(ap,fmt); @@ -399,17 +399,17 @@ void addReplyErrorFormat(redisClient *c, const char *fmt, ...) { sdsfree(s); } -void addReplyStatusLength(redisClient *c, const char *s, size_t len) { +void addReplyStatusLength(client *c, const char *s, size_t len) { addReplyString(c,"+",1); addReplyString(c,s,len); addReplyString(c,"\r\n",2); } -void addReplyStatus(redisClient *c, const char *status) { +void addReplyStatus(client *c, const char *status) { addReplyStatusLength(c,status,strlen(status)); } -void addReplyStatusFormat(redisClient *c, const char *fmt, ...) { +void addReplyStatusFormat(client *c, const char *fmt, ...) { va_list ap; va_start(ap,fmt); sds s = sdscatvprintf(sdsempty(),fmt,ap); @@ -420,7 +420,7 @@ void addReplyStatusFormat(redisClient *c, const char *fmt, ...) { /* Adds an empty object to the reply list that will contain the multi bulk * length, which is not known when this function is called. */ -void *addDeferredMultiBulkLength(redisClient *c) { +void *addDeferredMultiBulkLength(client *c) { /* Note that we install the write event here even if the object is not * ready to be sent, since we are sure that before returning to the * event loop setDeferredMultiBulkLength() will be called. */ @@ -430,7 +430,7 @@ void *addDeferredMultiBulkLength(redisClient *c) { } /* Populate the length object and try gluing it to the next chunk. */ -void setDeferredMultiBulkLength(redisClient *c, void *node, long length) { +void setDeferredMultiBulkLength(client *c, void *node, long length) { listNode *ln = (listNode*)node; robj *len, *next; @@ -457,7 +457,7 @@ void setDeferredMultiBulkLength(redisClient *c, void *node, long length) { } /* Add a double as a bulk reply */ -void addReplyDouble(redisClient *c, double d) { +void addReplyDouble(client *c, double d) { char dbuf[128], sbuf[128]; int dlen, slen; if (isinf(d)) { @@ -473,7 +473,7 @@ void addReplyDouble(redisClient *c, double d) { /* Add a long long as integer reply or bulk len / multi bulk count. * Basically this is used to output <prefix><long long><crlf>. */ -void addReplyLongLongWithPrefix(redisClient *c, long long ll, char prefix) { +void addReplyLongLongWithPrefix(client *c, long long ll, char prefix) { char buf[128]; int len; @@ -495,7 +495,7 @@ void addReplyLongLongWithPrefix(redisClient *c, long long ll, char prefix) { addReplyString(c,buf,len+3); } -void addReplyLongLong(redisClient *c, long long ll) { +void addReplyLongLong(client *c, long long ll) { if (ll == 0) addReply(c,shared.czero); else if (ll == 1) @@ -504,7 +504,7 @@ void addReplyLongLong(redisClient *c, long long ll) { addReplyLongLongWithPrefix(c,ll,':'); } -void addReplyMultiBulkLen(redisClient *c, long length) { +void addReplyMultiBulkLen(client *c, long length) { if (length < REDIS_SHARED_BULKHDR_LEN) addReply(c,shared.mbulkhdr[length]); else @@ -512,7 +512,7 @@ void addReplyMultiBulkLen(redisClient *c, long length) { } /* Create the length prefix of a bulk reply, example: $2234 */ -void addReplyBulkLen(redisClient *c, robj *obj) { +void addReplyBulkLen(client *c, robj *obj) { size_t len; if (sdsEncodedObject(obj)) { @@ -538,21 +538,21 @@ void addReplyBulkLen(redisClient *c, robj *obj) { } /* Add a Redis Object as a bulk reply */ -void addReplyBulk(redisClient *c, robj *obj) { +void addReplyBulk(client *c, robj *obj) { addReplyBulkLen(c,obj); addReply(c,obj); addReply(c,shared.crlf); } /* Add a C buffer as bulk reply */ -void addReplyBulkCBuffer(redisClient *c, const void *p, size_t len) { +void addReplyBulkCBuffer(client *c, const void *p, size_t len) { addReplyLongLongWithPrefix(c,len,'$'); addReplyString(c,p,len); addReply(c,shared.crlf); } /* Add sds to reply (takes ownership of sds and frees it) */ -void addReplyBulkSds(redisClient *c, sds s) { +void addReplyBulkSds(client *c, sds s) { addReplySds(c,sdscatfmt(sdsempty(),"$%u\r\n", (unsigned long)sdslen(s))); addReplySds(c,s); @@ -560,7 +560,7 @@ void addReplyBulkSds(redisClient *c, sds s) { } /* Add a C nul term string as bulk reply */ -void addReplyBulkCString(redisClient *c, const char *s) { +void addReplyBulkCString(client *c, const char *s) { if (s == NULL) { addReply(c,shared.nullbulk); } else { @@ -569,7 +569,7 @@ void addReplyBulkCString(redisClient *c, const char *s) { } /* Add a long long as a bulk reply */ -void addReplyBulkLongLong(redisClient *c, long long ll) { +void addReplyBulkLongLong(client *c, long long ll) { char buf[64]; int len; @@ -580,7 +580,7 @@ void addReplyBulkLongLong(redisClient *c, long long ll) { /* Copy 'src' client output buffers into 'dst' client output buffers. * The function takes care of freeing the old output buffers of the * destination client. */ -void copyClientOutputBuffer(redisClient *dst, redisClient *src) { +void copyClientOutputBuffer(client *dst, client *src) { listRelease(dst->reply); dst->reply = listDup(src->reply); memcpy(dst->buf,src->buf,src->bufpos); @@ -590,7 +590,7 @@ void copyClientOutputBuffer(redisClient *dst, redisClient *src) { #define MAX_ACCEPTS_PER_CALL 1000 static void acceptCommonHandler(int fd, int flags) { - redisClient *c; + client *c; if ((c = createClient(fd)) == NULL) { serverLog(REDIS_WARNING, "Error registering fd event for the new client: %s (fd=%d)", @@ -656,7 +656,7 @@ void acceptUnixHandler(aeEventLoop *el, int fd, void *privdata, int mask) { } } -static void freeClientArgv(redisClient *c) { +static void freeClientArgv(client *c) { int j; for (j = 0; j < c->argc; j++) decrRefCount(c->argv[j]); @@ -670,7 +670,7 @@ static void freeClientArgv(redisClient *c) { void disconnectSlaves(void) { while (listLength(server.slaves)) { listNode *ln = listFirst(server.slaves); - freeClient((redisClient*)ln->value); + freeClient((client*)ln->value); } } @@ -688,7 +688,7 @@ void replicationHandleMasterDisconnection(void) { if (server.masterhost != NULL) disconnectSlaves(); } -void freeClient(redisClient *c) { +void freeClient(client *c) { listNode *ln; /* If this is marked as current client unset it */ @@ -804,7 +804,7 @@ void freeClient(redisClient *c) { * This function is useful when we need to terminate a client but we are in * a context where calling freeClient() is not possible, because the client * should be valid for the continuation of the flow of the program. */ -void freeClientAsync(redisClient *c) { +void freeClientAsync(client *c) { if (c->flags & REDIS_CLOSE_ASAP || c->flags & REDIS_LUA_CLIENT) return; c->flags |= REDIS_CLOSE_ASAP; listAddNodeTail(server.clients_to_close,c); @@ -813,7 +813,7 @@ void freeClientAsync(redisClient *c) { void freeClientsInAsyncFreeQueue(void) { while (listLength(server.clients_to_close)) { listNode *ln = listFirst(server.clients_to_close); - redisClient *c = listNodeValue(ln); + client *c = listNodeValue(ln); c->flags &= ~REDIS_CLOSE_ASAP; freeClient(c); @@ -822,7 +822,7 @@ void freeClientsInAsyncFreeQueue(void) { } void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask) { - redisClient *c = privdata; + client *c = privdata; ssize_t nwritten = 0, totwritten = 0; size_t objlen; size_t objmem; @@ -906,7 +906,7 @@ void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask) { } /* resetClient prepare the client to process the next command */ -void resetClient(redisClient *c) { +void resetClient(client *c) { redisCommandProc *prevcmd = c->cmd ? c->cmd->proc : NULL; freeClientArgv(c); @@ -919,7 +919,7 @@ void resetClient(redisClient *c) { c->flags &= (~REDIS_ASKING); } -int processInlineBuffer(redisClient *c) { +int processInlineBuffer(client *c) { char *newline; int argc, j; sds *argv, aux; @@ -982,7 +982,7 @@ int processInlineBuffer(redisClient *c) { /* Helper function. Trims query buffer to make the function that processes * multi bulk requests idempotent. */ -static void setProtocolError(redisClient *c, int pos) { +static void setProtocolError(client *c, int pos) { if (server.verbosity <= REDIS_VERBOSE) { sds client = catClientInfoString(sdsempty(),c); serverLog(REDIS_VERBOSE, @@ -993,7 +993,7 @@ static void setProtocolError(redisClient *c, int pos) { sdsrange(c->querybuf,pos,-1); } -int processMultibulkBuffer(redisClient *c) { +int processMultibulkBuffer(client *c) { char *newline = NULL; int pos = 0, ok; long long ll; @@ -1131,7 +1131,7 @@ int processMultibulkBuffer(redisClient *c) { return REDIS_ERR; } -void processInputBuffer(redisClient *c) { +void processInputBuffer(client *c) { server.current_client = c; /* Keep processing while there is something in the input buffer */ while(sdslen(c->querybuf)) { @@ -1176,7 +1176,7 @@ void processInputBuffer(redisClient *c) { } void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int mask) { - redisClient *c = (redisClient*) privdata; + client *c = (client*) privdata; int nread, readlen; size_t qblen; REDIS_NOTUSED(el); @@ -1234,7 +1234,7 @@ void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int mask) { void getClientsMaxBuffers(unsigned long *longest_output_list, unsigned long *biggest_input_buffer) { - redisClient *c; + client *c; listNode *ln; listIter li; unsigned long lol = 0, bib = 0; @@ -1261,7 +1261,7 @@ void getClientsMaxBuffers(unsigned long *longest_output_list, * On failure the function still populates 'peerid' with the "?:0" string * in case you want to relax error checking or need to display something * anyway (see anetPeerToString implementation for more info). */ -void genClientPeerId(redisClient *client, char *peerid, +void genClientPeerId(client *client, char *peerid, size_t peerid_len) { if (client->flags & REDIS_UNIX_SOCKET) { /* Unix socket client. */ @@ -1276,7 +1276,7 @@ void genClientPeerId(redisClient *client, char *peerid, * if client->peerid is NULL, otherwise returning the cached value. * The Peer ID never changes during the life of the client, however it * is expensive to compute. */ -char *getClientPeerId(redisClient *c) { +char *getClientPeerId(client *c) { char peerid[REDIS_PEER_ID_LEN]; if (c->peerid == NULL) { @@ -1288,7 +1288,7 @@ char *getClientPeerId(redisClient *c) { /* Concatenate a string representing the state of a client in an human * readable format, into the sds string 's'. */ -sds catClientInfoString(sds s, redisClient *client) { +sds catClientInfoString(sds s, client *client) { char flags[16], events[3], *p; int emask; @@ -1341,7 +1341,7 @@ sds catClientInfoString(sds s, redisClient *client) { sds getAllClientsInfoString(void) { listNode *ln; listIter li; - redisClient *client; + client *client; sds o = sdsempty(); o = sdsMakeRoomFor(o,200*listLength(server.clients)); @@ -1354,10 +1354,10 @@ sds getAllClientsInfoString(void) { return o; } -void clientCommand(redisClient *c) { +void clientCommand(client *c) { listNode *ln; listIter li; - redisClient *client; + client *client; if (!strcasecmp(c->argv[1]->ptr,"list") && c->argc == 2) { /* CLIENT LIST */ @@ -1500,7 +1500,7 @@ void clientCommand(redisClient *c) { /* Rewrite the command vector of the client. All the new objects ref count * is incremented. The old command vector is freed, and the old objects * ref count is decremented. */ -void rewriteClientCommandVector(redisClient *c, int argc, ...) { +void rewriteClientCommandVector(client *c, int argc, ...) { va_list ap; int j; robj **argv; /* The new argument vector */ @@ -1528,7 +1528,7 @@ void rewriteClientCommandVector(redisClient *c, int argc, ...) { } /* Completely replace the client command vector with the provided one. */ -void replaceClientCommandVector(redisClient *c, int argc, robj **argv) { +void replaceClientCommandVector(client *c, int argc, robj **argv) { freeClientArgv(c); zfree(c->argv); c->argv = argv; @@ -1539,7 +1539,7 @@ void replaceClientCommandVector(redisClient *c, int argc, robj **argv) { /* Rewrite a single item in the command vector. * The new val ref count is incremented, and the old decremented. */ -void rewriteClientCommandArgument(redisClient *c, int i, robj *newval) { +void rewriteClientCommandArgument(client *c, int i, robj *newval) { robj *oldval; redisAssertWithInfo(c,NULL,i < c->argc); @@ -1568,7 +1568,7 @@ void rewriteClientCommandArgument(redisClient *c, int i, robj *newval) { * Note: this function is very fast so can be called as many time as * the caller wishes. The main usage of this function currently is * enforcing the client output length limits. */ -unsigned long getClientOutputBufferMemoryUsage(redisClient *c) { +unsigned long getClientOutputBufferMemoryUsage(client *c) { unsigned long list_item_size = sizeof(listNode)+sizeof(robj); return c->reply_bytes + (list_item_size*listLength(c->reply)); @@ -1582,7 +1582,7 @@ unsigned long getClientOutputBufferMemoryUsage(redisClient *c) { * REDIS_CLIENT_TYPE_SLAVE -> Slave or client executing MONITOR command * REDIS_CLIENT_TYPE_PUBSUB -> Client subscribed to Pub/Sub channels */ -int getClientType(redisClient *c) { +int getClientType(client *c) { if ((c->flags & REDIS_SLAVE) && !(c->flags & REDIS_MONITOR)) return REDIS_CLIENT_TYPE_SLAVE; if (c->flags & REDIS_PUBSUB) @@ -1612,7 +1612,7 @@ char *getClientTypeName(int class) { * * Return value: non-zero if the client reached the soft or the hard limit. * Otherwise zero is returned. */ -int checkClientOutputBufferLimits(redisClient *c) { +int checkClientOutputBufferLimits(client *c) { int soft = 0, hard = 0, class; unsigned long used_mem = getClientOutputBufferMemoryUsage(c); @@ -1653,7 +1653,7 @@ int checkClientOutputBufferLimits(redisClient *c) { * Note: we need to close the client asynchronously because this function is * called from contexts where the client can't be freed safely, i.e. from the * lower level functions pushing data inside the client output buffers. */ -void asyncCloseClientOnOutputBufferLimitReached(redisClient *c) { +void asyncCloseClientOnOutputBufferLimitReached(client *c) { redisAssert(c->reply_bytes < SIZE_MAX-(1024*64)); if (c->reply_bytes == 0 || c->flags & REDIS_CLOSE_ASAP) return; if (checkClientOutputBufferLimits(c)) { @@ -1673,7 +1673,7 @@ void flushSlavesOutputBuffers(void) { listRewind(server.slaves,&li); while((ln = listNext(&li))) { - redisClient *slave = listNodeValue(ln); + client *slave = listNodeValue(ln); int events; events = aeGetFileEvents(server.el,slave->fd); @@ -1717,7 +1717,7 @@ int clientsArePaused(void) { { listNode *ln; listIter li; - redisClient *c; + client *c; server.clients_paused = 0; diff --git a/src/object.c b/src/object.c index e3f44b3d8..d8fcf1658 100644 --- a/src/object.c +++ b/src/object.c @@ -339,7 +339,7 @@ robj *resetRefCount(robj *obj) { return obj; } -int checkType(redisClient *c, robj *o, int type) { +int checkType(client *c, robj *o, int type) { if (o->type != type) { addReply(c,shared.wrongtypeerr); return 1; @@ -562,7 +562,7 @@ int getDoubleFromObject(robj *o, double *target) { return REDIS_OK; } -int getDoubleFromObjectOrReply(redisClient *c, robj *o, double *target, const char *msg) { +int getDoubleFromObjectOrReply(client *c, robj *o, double *target, const char *msg) { double value; if (getDoubleFromObject(o, &value) != REDIS_OK) { if (msg != NULL) { @@ -600,7 +600,7 @@ int getLongDoubleFromObject(robj *o, long double *target) { return REDIS_OK; } -int getLongDoubleFromObjectOrReply(redisClient *c, robj *o, long double *target, const char *msg) { +int getLongDoubleFromObjectOrReply(client *c, robj *o, long double *target, const char *msg) { long double value; if (getLongDoubleFromObject(o, &value) != REDIS_OK) { if (msg != NULL) { @@ -638,7 +638,7 @@ int getLongLongFromObject(robj *o, long long *target) { return REDIS_OK; } -int getLongLongFromObjectOrReply(redisClient *c, robj *o, long long *target, const char *msg) { +int getLongLongFromObjectOrReply(client *c, robj *o, long long *target, const char *msg) { long long value; if (getLongLongFromObject(o, &value) != REDIS_OK) { if (msg != NULL) { @@ -652,7 +652,7 @@ int getLongLongFromObjectOrReply(redisClient *c, robj *o, long long *target, con return REDIS_OK; } -int getLongFromObjectOrReply(redisClient *c, robj *o, long *target, const char *msg) { +int getLongFromObjectOrReply(client *c, robj *o, long *target, const char *msg) { long long value; if (getLongLongFromObjectOrReply(c, o, &value, msg) != REDIS_OK) return REDIS_ERR; @@ -696,14 +696,14 @@ unsigned long long estimateObjectIdleTime(robj *o) { /* This is a helper function for the OBJECT command. We need to lookup keys * without any modification of LRU or other parameters. */ -robj *objectCommandLookup(redisClient *c, robj *key) { +robj *objectCommandLookup(client *c, robj *key) { dictEntry *de; if ((de = dictFind(c->db->dict,key->ptr)) == NULL) return NULL; return (robj*) dictGetVal(de); } -robj *objectCommandLookupOrReply(redisClient *c, robj *key, robj *reply) { +robj *objectCommandLookupOrReply(client *c, robj *key, robj *reply) { robj *o = objectCommandLookup(c,key); if (!o) addReply(c, reply); @@ -712,7 +712,7 @@ robj *objectCommandLookupOrReply(redisClient *c, robj *key, robj *reply) { /* Object command allows to inspect the internals of an Redis Object. * Usage: OBJECT <refcount|encoding|idletime> <key> */ -void objectCommand(redisClient *c) { +void objectCommand(client *c) { robj *o; if (!strcasecmp(c->argv[1]->ptr,"refcount") && c->argc == 3) { diff --git a/src/pubsub.c b/src/pubsub.c index 0711387c2..edb08b04b 100644 --- a/src/pubsub.c +++ b/src/pubsub.c @@ -48,14 +48,14 @@ int listMatchPubsubPattern(void *a, void *b) { } /* Return the number of channels + patterns a client is subscribed to. */ -int clientSubscriptionsCount(redisClient *c) { +int clientSubscriptionsCount(client *c) { return dictSize(c->pubsub_channels)+ listLength(c->pubsub_patterns); } /* Subscribe a client to a channel. Returns 1 if the operation succeeded, or * 0 if the client was already subscribed to that channel. */ -int pubsubSubscribeChannel(redisClient *c, robj *channel) { +int pubsubSubscribeChannel(client *c, robj *channel) { dictEntry *de; list *clients = NULL; int retval = 0; @@ -85,7 +85,7 @@ int pubsubSubscribeChannel(redisClient *c, robj *channel) { /* Unsubscribe a client from a channel. Returns 1 if the operation succeeded, or * 0 if the client was not subscribed to the specified channel. */ -int pubsubUnsubscribeChannel(redisClient *c, robj *channel, int notify) { +int pubsubUnsubscribeChannel(client *c, robj *channel, int notify) { dictEntry *de; list *clients; listNode *ln; @@ -124,7 +124,7 @@ int pubsubUnsubscribeChannel(redisClient *c, robj *channel, int notify) { } /* Subscribe a client to a pattern. Returns 1 if the operation succeeded, or 0 if the client was already subscribed to that pattern. */ -int pubsubSubscribePattern(redisClient *c, robj *pattern) { +int pubsubSubscribePattern(client *c, robj *pattern) { int retval = 0; if (listSearchKey(c->pubsub_patterns,pattern) == NULL) { @@ -147,7 +147,7 @@ int pubsubSubscribePattern(redisClient *c, robj *pattern) { /* Unsubscribe a client from a channel. Returns 1 if the operation succeeded, or * 0 if the client was not subscribed to the specified channel. */ -int pubsubUnsubscribePattern(redisClient *c, robj *pattern, int notify) { +int pubsubUnsubscribePattern(client *c, robj *pattern, int notify) { listNode *ln; pubsubPattern pat; int retval = 0; @@ -175,7 +175,7 @@ int pubsubUnsubscribePattern(redisClient *c, robj *pattern, int notify) { /* Unsubscribe from all the channels. Return the number of channels the * client was subscribed to. */ -int pubsubUnsubscribeAllChannels(redisClient *c, int notify) { +int pubsubUnsubscribeAllChannels(client *c, int notify) { dictIterator *di = dictGetSafeIterator(c->pubsub_channels); dictEntry *de; int count = 0; @@ -199,7 +199,7 @@ int pubsubUnsubscribeAllChannels(redisClient *c, int notify) { /* Unsubscribe from all the patterns. Return the number of patterns the * client was subscribed from. */ -int pubsubUnsubscribeAllPatterns(redisClient *c, int notify) { +int pubsubUnsubscribeAllPatterns(client *c, int notify) { listNode *ln; listIter li; int count = 0; @@ -237,7 +237,7 @@ int pubsubPublishMessage(robj *channel, robj *message) { listRewind(list,&li); while ((ln = listNext(&li)) != NULL) { - redisClient *c = ln->value; + client *c = ln->value; addReply(c,shared.mbulkhdr[3]); addReply(c,shared.messagebulk); @@ -274,7 +274,7 @@ int pubsubPublishMessage(robj *channel, robj *message) { * Pubsub commands implementation *----------------------------------------------------------------------------*/ -void subscribeCommand(redisClient *c) { +void subscribeCommand(client *c) { int j; for (j = 1; j < c->argc; j++) @@ -282,7 +282,7 @@ void subscribeCommand(redisClient *c) { c->flags |= REDIS_PUBSUB; } -void unsubscribeCommand(redisClient *c) { +void unsubscribeCommand(client *c) { if (c->argc == 1) { pubsubUnsubscribeAllChannels(c,1); } else { @@ -294,7 +294,7 @@ void unsubscribeCommand(redisClient *c) { if (clientSubscriptionsCount(c) == 0) c->flags &= ~REDIS_PUBSUB; } -void psubscribeCommand(redisClient *c) { +void psubscribeCommand(client *c) { int j; for (j = 1; j < c->argc; j++) @@ -302,7 +302,7 @@ void psubscribeCommand(redisClient *c) { c->flags |= REDIS_PUBSUB; } -void punsubscribeCommand(redisClient *c) { +void punsubscribeCommand(client *c) { if (c->argc == 1) { pubsubUnsubscribeAllPatterns(c,1); } else { @@ -314,7 +314,7 @@ void punsubscribeCommand(redisClient *c) { if (clientSubscriptionsCount(c) == 0) c->flags &= ~REDIS_PUBSUB; } -void publishCommand(redisClient *c) { +void publishCommand(client *c) { int receivers = pubsubPublishMessage(c->argv[1],c->argv[2]); if (server.cluster_enabled) clusterPropagatePublish(c->argv[1],c->argv[2]); @@ -324,7 +324,7 @@ void publishCommand(redisClient *c) { } /* PUBSUB command for Pub/Sub introspection. */ -void pubsubCommand(redisClient *c) { +void pubsubCommand(client *c) { if (!strcasecmp(c->argv[1]->ptr,"channels") && (c->argc == 2 || c->argc ==3)) { @@ -1482,7 +1482,7 @@ void backgroundSaveDoneHandlerSocket(int exitcode, int bysignal) { listRewind(server.slaves,&li); while((ln = listNext(&li))) { - redisClient *slave = ln->value; + client *slave = ln->value; if (slave->replstate == REDIS_REPL_WAIT_BGSAVE_END) { uint64_t j; @@ -1566,7 +1566,7 @@ int rdbSaveToSlavesSockets(void) { listRewind(server.slaves,&li); while((ln = listNext(&li))) { - redisClient *slave = ln->value; + client *slave = ln->value; if (slave->replstate == REDIS_REPL_WAIT_BGSAVE_START) { clientids[numfds] = slave->id; @@ -1672,7 +1672,7 @@ int rdbSaveToSlavesSockets(void) { return REDIS_OK; /* unreached */ } -void saveCommand(redisClient *c) { +void saveCommand(client *c) { if (server.rdb_child_pid != -1) { addReplyError(c,"Background save already in progress"); return; @@ -1684,7 +1684,7 @@ void saveCommand(redisClient *c) { } } -void bgsaveCommand(redisClient *c) { +void bgsaveCommand(client *c) { if (server.rdb_child_pid != -1) { addReplyError(c,"Background save already in progress"); } else if (server.aof_child_pid != -1) { diff --git a/src/replication.c b/src/replication.c index 5f366f189..fb983218c 100644 --- a/src/replication.c +++ b/src/replication.c @@ -40,7 +40,7 @@ void replicationDiscardCachedMaster(void); void replicationResurrectCachedMaster(int newfd); void replicationSendAck(void); -void putSlaveOnline(redisClient *slave); +void putSlaveOnline(client *slave); /* --------------------------- Utility functions ---------------------------- */ @@ -48,7 +48,7 @@ void putSlaveOnline(redisClient *slave); * pair. Mostly useful for logging, since we want to log a slave using its * IP address and it's listening port which is more clear for the user, for * example: "Closing connection with slave 10.1.2.3:6380". */ -char *replicationGetSlaveName(redisClient *c) { +char *replicationGetSlaveName(client *c) { static char buf[REDIS_PEER_ID_LEN]; char ip[REDIS_IP_STR_LEN]; @@ -200,7 +200,7 @@ void replicationFeedSlaves(list *slaves, int dictid, robj **argv, int argc) { /* Send it to slaves. */ listRewind(slaves,&li); while((ln = listNext(&li))) { - redisClient *slave = ln->value; + client *slave = ln->value; addReply(slave,selectcmd); } @@ -239,7 +239,7 @@ void replicationFeedSlaves(list *slaves, int dictid, robj **argv, int argc) { /* Write the command to every slave. */ listRewind(server.slaves,&li); while((ln = listNext(&li))) { - redisClient *slave = ln->value; + client *slave = ln->value; /* Don't feed slaves that are still waiting for BGSAVE to start */ if (slave->replstate == REDIS_REPL_WAIT_BGSAVE_START) continue; @@ -258,7 +258,7 @@ void replicationFeedSlaves(list *slaves, int dictid, robj **argv, int argc) { } } -void replicationFeedMonitors(redisClient *c, list *monitors, int dictid, robj **argv, int argc) { +void replicationFeedMonitors(client *c, list *monitors, int dictid, robj **argv, int argc) { listNode *ln; listIter li; int j; @@ -291,7 +291,7 @@ void replicationFeedMonitors(redisClient *c, list *monitors, int dictid, robj ** listRewind(monitors,&li); while((ln = listNext(&li))) { - redisClient *monitor = ln->value; + client *monitor = ln->value; addReply(monitor,cmdobj); } decrRefCount(cmdobj); @@ -299,7 +299,7 @@ void replicationFeedMonitors(redisClient *c, list *monitors, int dictid, robj ** /* Feed the slave 'c' with the replication backlog starting from the * specified 'offset' up to the end of the backlog. */ -long long addReplyReplicationBacklog(redisClient *c, long long offset) { +long long addReplyReplicationBacklog(client *c, long long offset) { long long j, skip, len; serverLog(REDIS_DEBUG, "[PSYNC] Slave request offset: %lld", offset); @@ -354,7 +354,7 @@ long long addReplyReplicationBacklog(redisClient *c, long long offset) { * * On success return REDIS_OK, otherwise REDIS_ERR is returned and we proceed * with the usual full resync. */ -int masterTryPartialResynchronization(redisClient *c) { +int masterTryPartialResynchronization(client *c) { long long psync_offset, psync_len; char *master_runid = c->argv[1]->ptr; char buf[128]; @@ -460,7 +460,7 @@ int startBgsaveForReplication(void) { } /* SYNC and PSYNC command implemenation. */ -void syncCommand(redisClient *c) { +void syncCommand(client *c) { /* ignore SYNC if already slave or in monitor mode */ if (c->flags & REDIS_SLAVE) return; @@ -523,7 +523,7 @@ void syncCommand(redisClient *c) { /* Ok a background save is in progress. Let's check if it is a good * one for replication, i.e. if there is another slave that is * registering differences since the server forked to save. */ - redisClient *slave; + client *slave; listNode *ln; listIter li; @@ -594,7 +594,7 @@ void syncCommand(redisClient *c) { * In the future the same command can be used in order to configure * the replication to initiate an incremental replication instead of a * full resync. */ -void replconfCommand(redisClient *c) { +void replconfCommand(client *c) { int j; if ((c->argc % 2) == 0) { @@ -658,7 +658,7 @@ void replconfCommand(redisClient *c) { * command disables it, so that we can accumulate output buffer without * sending it to the slave. * 3) Update the count of good slaves. */ -void putSlaveOnline(redisClient *slave) { +void putSlaveOnline(client *slave) { slave->replstate = REDIS_REPL_ONLINE; slave->repl_put_online_on_ack = 0; slave->repl_ack_time = server.unixtime; /* Prevent false timeout. */ @@ -674,7 +674,7 @@ void putSlaveOnline(redisClient *slave) { } void sendBulkToSlave(aeEventLoop *el, int fd, void *privdata, int mask) { - redisClient *slave = privdata; + client *slave = privdata; REDIS_NOTUSED(el); REDIS_NOTUSED(mask); char buf[REDIS_IOBUF_LEN]; @@ -750,7 +750,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) { listRewind(server.slaves,&li); while((ln = listNext(&li))) { - redisClient *slave = ln->value; + client *slave = ln->value; if (slave->replstate == REDIS_REPL_WAIT_BGSAVE_START) { startbgsave = 1; @@ -808,7 +808,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) { listRewind(server.slaves,&li); serverLog(REDIS_WARNING,"SYNC failed. BGSAVE failed"); while((ln = listNext(&li))) { - redisClient *slave = ln->value; + client *slave = ln->value; if (slave->replstate == REDIS_REPL_WAIT_BGSAVE_START) freeClient(slave); @@ -1477,7 +1477,7 @@ void replicationUnsetMaster(void) { server.repl_state = REDIS_REPL_NONE; } -void slaveofCommand(redisClient *c) { +void slaveofCommand(client *c) { /* SLAVEOF is not allowed in cluster mode as replication is automatically * configured using the current address of the master node. */ if (server.cluster_enabled) { @@ -1518,7 +1518,7 @@ void slaveofCommand(redisClient *c) { /* ROLE command: provide information about the role of the instance * (master or slave) and additional information related to replication * in an easy to process format. */ -void roleCommand(redisClient *c) { +void roleCommand(client *c) { if (server.masterhost == NULL) { listIter li; listNode *ln; @@ -1531,7 +1531,7 @@ void roleCommand(redisClient *c) { mbcount = addDeferredMultiBulkLength(c); listRewind(server.slaves,&li); while((ln = listNext(&li))) { - redisClient *slave = ln->value; + client *slave = ln->value; char ip[REDIS_IP_STR_LEN]; if (anetPeerToString(slave->fd,ip,sizeof(ip),NULL) == -1) continue; @@ -1568,7 +1568,7 @@ void roleCommand(redisClient *c) { * processed offset. If we are not connected with a master, the command has * no effects. */ void replicationSendAck(void) { - redisClient *c = server.master; + client *c = server.master; if (c != NULL) { c->flags |= REDIS_MASTER_FORCE_REPLY; @@ -1600,7 +1600,7 @@ void replicationSendAck(void) { * replicationResurrectCachedMaster() that is used after a successful PSYNC * handshake in order to reactivate the cached master. */ -void replicationCacheMaster(redisClient *c) { +void replicationCacheMaster(client *c) { listNode *ln; redisAssert(server.master != NULL && server.cached_master == NULL); @@ -1697,7 +1697,7 @@ void refreshGoodSlavesCount(void) { listRewind(server.slaves,&li); while((ln = listNext(&li))) { - redisClient *slave = ln->value; + client *slave = ln->value; time_t lag = server.unixtime - slave->repl_ack_time; if (slave->replstate == REDIS_REPL_ONLINE && @@ -1833,7 +1833,7 @@ int replicationCountAcksByOffset(long long offset) { listRewind(server.slaves,&li); while((ln = listNext(&li))) { - redisClient *slave = ln->value; + client *slave = ln->value; if (slave->replstate != REDIS_REPL_ONLINE) continue; if (slave->repl_ack_off >= offset) count++; @@ -1843,7 +1843,7 @@ int replicationCountAcksByOffset(long long offset) { /* WAIT for N replicas to acknowledge the processing of our latest * write command (and all the previous commands). */ -void waitCommand(redisClient *c) { +void waitCommand(client *c) { mstime_t timeout; long numreplicas, ackreplicas; long long offset = c->woff; @@ -1878,7 +1878,7 @@ void waitCommand(redisClient *c) { * specific cleanup. We just remove the client from the list of clients * waiting for replica acks. Never call it directly, call unblockClient() * instead. */ -void unblockClientWaitingReplicas(redisClient *c) { +void unblockClientWaitingReplicas(client *c) { listNode *ln = listSearchKey(server.clients_waiting_acks,c); redisAssert(ln != NULL); listDelNode(server.clients_waiting_acks,ln); @@ -1895,7 +1895,7 @@ void processClientsWaitingReplicas(void) { listRewind(server.clients_waiting_acks,&li); while((ln = listNext(&li))) { - redisClient *c = ln->value; + client *c = ln->value; /* Every time we find a client that is satisfied for a given * offset and number of replicas, we remember it so the next client @@ -2005,7 +2005,7 @@ void replicationCron(void) { * last-io timer preventing a timeout. */ listRewind(server.slaves,&li); while((ln = listNext(&li))) { - redisClient *slave = ln->value; + client *slave = ln->value; if (slave->replstate == REDIS_REPL_WAIT_BGSAVE_START || (slave->replstate == REDIS_REPL_WAIT_BGSAVE_END && @@ -2025,7 +2025,7 @@ void replicationCron(void) { listRewind(server.slaves,&li); while((ln = listNext(&li))) { - redisClient *slave = ln->value; + client *slave = ln->value; if (slave->replstate != REDIS_REPL_ONLINE) continue; if (slave->flags & REDIS_PRE_PSYNC) continue; @@ -2079,7 +2079,7 @@ void replicationCron(void) { listRewind(server.slaves,&li); while((ln = listNext(&li))) { - redisClient *slave = ln->value; + client *slave = ln->value; if (slave->replstate == REDIS_REPL_WAIT_BGSAVE_START) { idle = server.unixtime - slave->lastinteraction; if (idle > max_idle) max_idle = idle; @@ -2098,7 +2098,7 @@ void replicationCron(void) { * startBgsaveForReplication(). */ listRewind(server.slaves,&li); while((ln = listNext(&li))) { - redisClient *slave = ln->value; + client *slave = ln->value; if (slave->replstate == REDIS_REPL_WAIT_BGSAVE_START) slave->replstate = REDIS_REPL_WAIT_BGSAVE_END; } diff --git a/src/scripting.c b/src/scripting.c index 79547aa4d..6be950ace 100644 --- a/src/scripting.c +++ b/src/scripting.c @@ -206,7 +206,7 @@ void luaSortArray(lua_State *lua) { int luaRedisGenericCommand(lua_State *lua, int raise_error) { int j, argc = lua_gettop(lua); struct redisCommand *cmd; - redisClient *c = server.lua_client; + client *c = server.lua_client; sds reply; /* Cached across calls. */ @@ -798,7 +798,7 @@ void sha1hex(char *digest, char *script, size_t len) { digest[40] = '\0'; } -void luaReplyToRedisReply(redisClient *c, lua_State *lua) { +void luaReplyToRedisReply(client *c, lua_State *lua) { int t = lua_type(lua,-1); switch(t) { @@ -884,7 +884,7 @@ void luaSetGlobalArray(lua_State *lua, char *var, robj **elev, int elec) { * On success REDIS_OK is returned, and nothing is left on the Lua stack. * On error REDIS_ERR is returned and an appropriate error is set in the * client context. */ -int luaCreateFunction(redisClient *c, lua_State *lua, char *funcname, robj *body) { +int luaCreateFunction(client *c, lua_State *lua, char *funcname, robj *body) { sds funcdef = sdsempty(); funcdef = sdscat(funcdef,"function "); @@ -920,7 +920,7 @@ int luaCreateFunction(redisClient *c, lua_State *lua, char *funcname, robj *body return REDIS_OK; } -void evalGenericCommand(redisClient *c, int evalsha) { +void evalGenericCommand(client *c, int evalsha) { lua_State *lua = server.lua; char funcname[43]; long long numkeys; @@ -1090,11 +1090,11 @@ void evalGenericCommand(redisClient *c, int evalsha) { } } -void evalCommand(redisClient *c) { +void evalCommand(client *c) { evalGenericCommand(c,0); } -void evalShaCommand(redisClient *c) { +void evalShaCommand(client *c) { if (sdslen(c->argv[1]->ptr) != 40) { /* We know that a match is not possible if the provided SHA is * not the right length. So we return an error ASAP, this way @@ -1149,7 +1149,7 @@ int redis_math_randomseed (lua_State *L) { * SCRIPT command for script environment introspection and control * ------------------------------------------------------------------------- */ -void scriptCommand(redisClient *c) { +void scriptCommand(client *c) { if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"flush")) { scriptingReset(); addReply(c,shared.ok); diff --git a/src/sentinel.c b/src/sentinel.c index bd315ccd5..42e8eab1f 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -416,11 +416,11 @@ dictType leaderVotesDictType = { /* =========================== Initialization =============================== */ -void sentinelCommand(redisClient *c); -void sentinelInfoCommand(redisClient *c); -void sentinelSetCommand(redisClient *c); -void sentinelPublishCommand(redisClient *c); -void sentinelRoleCommand(redisClient *c); +void sentinelCommand(client *c); +void sentinelInfoCommand(client *c); +void sentinelSetCommand(client *c); +void sentinelPublishCommand(client *c); +void sentinelRoleCommand(client *c); struct redisCommand sentinelcmds[] = { {"ping",pingCommand,1,"",0,NULL,0,0,0,0,0}, @@ -859,7 +859,7 @@ void sentinelKillTimedoutScripts(void) { } /* Implements SENTINEL PENDING-SCRIPTS command. */ -void sentinelPendingScriptsCommand(redisClient *c) { +void sentinelPendingScriptsCommand(client *c) { listNode *ln; listIter li; @@ -2604,7 +2604,7 @@ const char *sentinelFailoverStateStr(int state) { } /* Redis instance to Redis protocol representation. */ -void addReplySentinelRedisInstance(redisClient *c, sentinelRedisInstance *ri) { +void addReplySentinelRedisInstance(client *c, sentinelRedisInstance *ri) { char *flags = sdsempty(); void *mbl; int fields = 0; @@ -2795,7 +2795,7 @@ void addReplySentinelRedisInstance(redisClient *c, sentinelRedisInstance *ri) { /* Output a number of instances contained inside a dictionary as * Redis protocol. */ -void addReplyDictOfRedisInstances(redisClient *c, dict *instances) { +void addReplyDictOfRedisInstances(client *c, dict *instances) { dictIterator *di; dictEntry *de; @@ -2812,7 +2812,7 @@ void addReplyDictOfRedisInstances(redisClient *c, dict *instances) { /* Lookup the named master into sentinel.masters. * If the master is not found reply to the client with an error and returns * NULL. */ -sentinelRedisInstance *sentinelGetMasterByNameOrReplyError(redisClient *c, +sentinelRedisInstance *sentinelGetMasterByNameOrReplyError(client *c, robj *name) { sentinelRedisInstance *ri; @@ -2850,7 +2850,7 @@ int sentinelIsQuorumReachable(sentinelRedisInstance *master, int *usableptr) { return result; } -void sentinelCommand(redisClient *c) { +void sentinelCommand(client *c) { if (!strcasecmp(c->argv[1]->ptr,"masters")) { /* SENTINEL MASTERS */ if (c->argc != 2) goto numargserr; @@ -3166,7 +3166,7 @@ numargserr: } /* SENTINEL INFO [section] */ -void sentinelInfoCommand(redisClient *c) { +void sentinelInfoCommand(client *c) { if (c->argc > 2) { addReply(c,shared.syntaxerr); return; @@ -3232,7 +3232,7 @@ void sentinelInfoCommand(redisClient *c) { /* Implements Sentinel verison of the ROLE command. The output is * "sentinel" and the list of currently monitored master names. */ -void sentinelRoleCommand(redisClient *c) { +void sentinelRoleCommand(client *c) { dictIterator *di; dictEntry *de; @@ -3250,7 +3250,7 @@ void sentinelRoleCommand(redisClient *c) { } /* SENTINEL SET <mastername> [<option> <value> ...] */ -void sentinelSetCommand(redisClient *c) { +void sentinelSetCommand(client *c) { sentinelRedisInstance *ri; int j, changes = 0; char *option, *value; @@ -3343,7 +3343,7 @@ badfmt: /* Bad format errors */ * * Because we have a Sentinel PUBLISH, the code to send hello messages is the same * for all the three kind of instances: masters, slaves, sentinels. */ -void sentinelPublishCommand(redisClient *c) { +void sentinelPublishCommand(client *c) { if (strcmp(c->argv[1]->ptr,SENTINEL_HELLO_CHANNEL)) { addReplyError(c, "Only HELLO messages are accepted by Sentinel instances."); return; diff --git a/src/server.c b/src/server.c index b666e8d63..b9955115b 100644 --- a/src/server.c +++ b/src/server.c @@ -915,7 +915,7 @@ long long getInstantaneousMetric(int metric) { * The function gets the current time in milliseconds as argument since * it gets called multiple times in a loop, so calling gettimeofday() for * each iteration would be costly without any actual gain. */ -int clientsCronHandleTimeout(redisClient *c, mstime_t now_ms) { +int clientsCronHandleTimeout(client *c, mstime_t now_ms) { time_t now = now_ms/1000; if (server.maxidletime && @@ -951,7 +951,7 @@ int clientsCronHandleTimeout(redisClient *c, mstime_t now_ms) { * free space not used, this function reclaims space if needed. * * The function always returns 0 as it never terminates the client. */ -int clientsCronResizeQueryBuffer(redisClient *c) { +int clientsCronResizeQueryBuffer(client *c) { size_t querybuf_size = sdsAllocSize(c->querybuf); time_t idletime = server.unixtime - c->lastinteraction; @@ -991,7 +991,7 @@ void clientsCron(void) { numclients : CLIENTS_CRON_MIN_ITERATIONS; while(listLength(server.clients) && iterations--) { - redisClient *c; + client *c; listNode *head; /* Rotate the list, take the current head, process. @@ -2071,7 +2071,7 @@ void alsoPropagate(struct redisCommand *cmd, int dbid, robj **argv, int argc, /* It is possible to call the function forceCommandPropagation() inside a * Redis command implementation in order to to force the propagation of a * specific command execution into AOF / Replication. */ -void forceCommandPropagation(redisClient *c, int flags) { +void forceCommandPropagation(client *c, int flags) { if (flags & REDIS_PROPAGATE_REPL) c->flags |= REDIS_FORCE_REPL; if (flags & REDIS_PROPAGATE_AOF) c->flags |= REDIS_FORCE_AOF; } @@ -2079,12 +2079,12 @@ void forceCommandPropagation(redisClient *c, int flags) { /* Avoid that the executed command is propagated at all. This way we * are free to just propagate what we want using the alsoPropagate() * API. */ -void preventCommandPropagation(redisClient *c) { +void preventCommandPropagation(client *c) { c->flags |= REDIS_PREVENT_PROP; } /* Call() is the core of Redis execution of a command */ -void call(redisClient *c, int flags) { +void call(client *c, int flags) { long long dirty, start, duration; int client_old_flags = c->flags; @@ -2179,7 +2179,7 @@ void call(redisClient *c, int flags) { * If 1 is returned the client is still alive and valid and * other operations can be performed by the caller. Otherwise * if 0 is returned the client was destroyed (i.e. after QUIT). */ -int processCommand(redisClient *c) { +int processCommand(client *c) { /* The QUIT command is handled separately. Normal command procs will * go through checking for replication and QUIT will cause trouble * when FORCE_REPLICATION is enabled and would be implemented in @@ -2476,7 +2476,7 @@ int time_independent_strcmp(char *a, char *b) { return diff; /* If zero strings are the same. */ } -void authCommand(redisClient *c) { +void authCommand(client *c) { if (!server.requirepass) { addReplyError(c,"Client sent AUTH, but no password is set"); } else if (!time_independent_strcmp(c->argv[1]->ptr, server.requirepass)) { @@ -2490,7 +2490,7 @@ void authCommand(redisClient *c) { /* The PING command. It works in a different way if the client is in * in Pub/Sub mode. */ -void pingCommand(redisClient *c) { +void pingCommand(client *c) { /* The command takes zero or one arguments. */ if (c->argc > 2) { addReplyErrorFormat(c,"wrong number of arguments for '%s' command", @@ -2513,11 +2513,11 @@ void pingCommand(redisClient *c) { } } -void echoCommand(redisClient *c) { +void echoCommand(client *c) { addReplyBulk(c,c->argv[1]); } -void timeCommand(redisClient *c) { +void timeCommand(client *c) { struct timeval tv; /* gettimeofday() can only fail if &tv is a bad address so we @@ -2529,7 +2529,7 @@ void timeCommand(redisClient *c) { } /* Helper function for addReplyCommand() to output flags. */ -int addReplyCommandFlag(redisClient *c, struct redisCommand *cmd, int f, char *reply) { +int addReplyCommandFlag(client *c, struct redisCommand *cmd, int f, char *reply) { if (cmd->flags & f) { addReplyStatus(c, reply); return 1; @@ -2538,7 +2538,7 @@ int addReplyCommandFlag(redisClient *c, struct redisCommand *cmd, int f, char *r } /* Output the representation of a Redis command. Used by the COMMAND command. */ -void addReplyCommand(redisClient *c, struct redisCommand *cmd) { +void addReplyCommand(client *c, struct redisCommand *cmd) { if (!cmd) { addReply(c, shared.nullbulk); } else { @@ -2575,7 +2575,7 @@ void addReplyCommand(redisClient *c, struct redisCommand *cmd) { } /* COMMAND <subcommand> <args> */ -void commandCommand(redisClient *c) { +void commandCommand(client *c) { dictIterator *di; dictEntry *de; @@ -3010,7 +3010,7 @@ sds genRedisInfoString(char *section) { listRewind(server.slaves,&li); while((ln = listNext(&li))) { - redisClient *slave = listNodeValue(ln); + client *slave = listNodeValue(ln); char *state = NULL; char ip[REDIS_IP_STR_LEN]; int port; @@ -3113,7 +3113,7 @@ sds genRedisInfoString(char *section) { return info; } -void infoCommand(redisClient *c) { +void infoCommand(client *c) { char *section = c->argc == 2 ? c->argv[1]->ptr : "default"; if (c->argc > 2) { @@ -3123,7 +3123,7 @@ void infoCommand(redisClient *c) { addReplyBulkSds(c, genRedisInfoString(section)); } -void monitorCommand(redisClient *c) { +void monitorCommand(client *c) { /* ignore MONITOR if already slave or in monitor mode */ if (c->flags & REDIS_SLAVE) return; @@ -3274,7 +3274,7 @@ int freeMemoryIfNeeded(void) { listRewind(server.slaves,&li); while((ln = listNext(&li))) { - redisClient *slave = listNodeValue(ln); + client *slave = listNodeValue(ln); unsigned long obuf_bytes = getClientOutputBufferMemoryUsage(slave); if (obuf_bytes > mem_used) mem_used = 0; diff --git a/src/server.h b/src/server.h index 2e926b989..71a52cc9a 100644 --- a/src/server.h +++ b/src/server.h @@ -528,7 +528,7 @@ typedef struct readyList { /* With multiplexing we need to take per-client state. * Clients are taken in a linked list. */ -typedef struct redisClient { +typedef struct client { uint64_t id; /* Client incremental unique ID. */ int fd; redisDb *db; @@ -574,7 +574,7 @@ typedef struct redisClient { /* Response buffer */ int bufpos; char buf[REDIS_REPLY_CHUNK_BYTES]; -} redisClient; +} client; struct saveparam { time_t seconds; @@ -695,7 +695,7 @@ struct redisServer { list *clients; /* List of active clients */ list *clients_to_close; /* Clients to close asynchronously */ list *slaves, *monitors; /* List of slaves and MONITORs */ - redisClient *current_client; /* Current client, only used on crash report */ + client *current_client; /* Current client, only used on crash report */ int clients_paused; /* True if clients are currently paused */ mstime_t clients_pause_end_time; /* Time when we undo clients_paused */ char neterr[ANET_ERR_LEN]; /* Error buffer for anet.c */ @@ -835,8 +835,8 @@ struct redisServer { char *masterhost; /* Hostname of master */ int masterport; /* Port of master */ int repl_timeout; /* Timeout after N seconds of master idle */ - redisClient *master; /* Client that is master for this slave */ - redisClient *cached_master; /* Cached master to be reused for PSYNC. */ + client *master; /* Client that is master for this slave */ + client *cached_master; /* Cached master to be reused for PSYNC. */ int repl_syncio_timeout; /* Timeout for synchronous I/O calls */ int repl_state; /* Replication status if the instance is a slave */ off_t repl_transfer_size; /* Size of RDB to read from master during sync. */ @@ -904,8 +904,8 @@ struct redisServer { there is at least an uncovered slot. */ /* Scripting */ lua_State *lua; /* The Lua interpreter. We use just one for all clients */ - redisClient *lua_client; /* The "fake client" to query Redis from Lua */ - redisClient *lua_caller; /* The client running EVAL right now, or NULL */ + client *lua_client; /* The "fake client" to query Redis from Lua */ + client *lua_caller; /* The client running EVAL right now, or NULL */ dict *lua_scripts; /* A dictionary of SHA1 -> Lua scripts */ mstime_t lua_time_limit; /* Script timeout in milliseconds */ mstime_t lua_time_start; /* Start time of script, milliseconds time */ @@ -930,11 +930,11 @@ struct redisServer { }; typedef struct pubsubPattern { - redisClient *client; + client *client; robj *pattern; } pubsubPattern; -typedef void redisCommandProc(redisClient *c); +typedef void redisCommandProc(client *c); typedef int *redisGetKeysProc(struct redisCommand *cmd, robj **argv, int argc, int *numkeys); struct redisCommand { char *name; @@ -1039,46 +1039,46 @@ size_t redisPopcount(void *s, long count); void redisSetProcTitle(char *title); /* networking.c -- Networking and Client related operations */ -redisClient *createClient(int fd); +client *createClient(int fd); void closeTimedoutClients(void); -void freeClient(redisClient *c); -void freeClientAsync(redisClient *c); -void resetClient(redisClient *c); +void freeClient(client *c); +void freeClientAsync(client *c); +void resetClient(client *c); void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask); -void *addDeferredMultiBulkLength(redisClient *c); -void setDeferredMultiBulkLength(redisClient *c, void *node, long length); -void processInputBuffer(redisClient *c); +void *addDeferredMultiBulkLength(client *c); +void setDeferredMultiBulkLength(client *c, void *node, long length); +void processInputBuffer(client *c); void acceptHandler(aeEventLoop *el, int fd, void *privdata, int mask); void acceptTcpHandler(aeEventLoop *el, int fd, void *privdata, int mask); void acceptUnixHandler(aeEventLoop *el, int fd, void *privdata, int mask); void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int mask); -void addReplyBulk(redisClient *c, robj *obj); -void addReplyBulkCString(redisClient *c, const char *s); -void addReplyBulkCBuffer(redisClient *c, const void *p, size_t len); -void addReplyBulkLongLong(redisClient *c, long long ll); -void addReply(redisClient *c, robj *obj); -void addReplySds(redisClient *c, sds s); -void addReplyBulkSds(redisClient *c, sds s); -void addReplyError(redisClient *c, const char *err); -void addReplyStatus(redisClient *c, const char *status); -void addReplyDouble(redisClient *c, double d); -void addReplyLongLong(redisClient *c, long long ll); -void addReplyMultiBulkLen(redisClient *c, long length); -void copyClientOutputBuffer(redisClient *dst, redisClient *src); +void addReplyBulk(client *c, robj *obj); +void addReplyBulkCString(client *c, const char *s); +void addReplyBulkCBuffer(client *c, const void *p, size_t len); +void addReplyBulkLongLong(client *c, long long ll); +void addReply(client *c, robj *obj); +void addReplySds(client *c, sds s); +void addReplyBulkSds(client *c, sds s); +void addReplyError(client *c, const char *err); +void addReplyStatus(client *c, const char *status); +void addReplyDouble(client *c, double d); +void addReplyLongLong(client *c, long long ll); +void addReplyMultiBulkLen(client *c, long length); +void copyClientOutputBuffer(client *dst, client *src); void *dupClientReplyValue(void *o); void getClientsMaxBuffers(unsigned long *longest_output_list, unsigned long *biggest_input_buffer); void formatPeerId(char *peerid, size_t peerid_len, char *ip, int port); -char *getClientPeerId(redisClient *client); -sds catClientInfoString(sds s, redisClient *client); +char *getClientPeerId(client *client); +sds catClientInfoString(sds s, client *client); sds getAllClientsInfoString(void); -void rewriteClientCommandVector(redisClient *c, int argc, ...); -void rewriteClientCommandArgument(redisClient *c, int i, robj *newval); -void replaceClientCommandVector(redisClient *c, int argc, robj **argv); -unsigned long getClientOutputBufferMemoryUsage(redisClient *c); +void rewriteClientCommandVector(client *c, int argc, ...); +void rewriteClientCommandArgument(client *c, int i, robj *newval); +void replaceClientCommandVector(client *c, int argc, robj **argv); +unsigned long getClientOutputBufferMemoryUsage(client *c); void freeClientsInAsyncFreeQueue(void); -void asyncCloseClientOnOutputBufferLimitReached(redisClient *c); -int getClientType(redisClient *c); +void asyncCloseClientOnOutputBufferLimitReached(client *c); +int getClientType(client *c); int getClientTypeByName(char *name); char *getClientTypeName(int class); void flushSlavesOutputBuffers(void); @@ -1089,13 +1089,13 @@ int clientsArePaused(void); int processEventsWhileBlocked(void); #ifdef __GNUC__ -void addReplyErrorFormat(redisClient *c, const char *fmt, ...) +void addReplyErrorFormat(client *c, const char *fmt, ...) __attribute__((format(printf, 2, 3))); -void addReplyStatusFormat(redisClient *c, const char *fmt, ...) +void addReplyStatusFormat(client *c, const char *fmt, ...) __attribute__((format(printf, 2, 3))); #else -void addReplyErrorFormat(redisClient *c, const char *fmt, ...); -void addReplyStatusFormat(redisClient *c, const char *fmt, ...); +void addReplyErrorFormat(client *c, const char *fmt, ...); +void addReplyStatusFormat(client *c, const char *fmt, ...); #endif /* List data type */ @@ -1111,20 +1111,20 @@ void listTypeInsert(listTypeEntry *entry, robj *value, int where); int listTypeEqual(listTypeEntry *entry, robj *o); void listTypeDelete(listTypeIterator *iter, listTypeEntry *entry); void listTypeConvert(robj *subject, int enc); -void unblockClientWaitingData(redisClient *c); +void unblockClientWaitingData(client *c); void handleClientsBlockedOnLists(void); -void popGenericCommand(redisClient *c, int where); +void popGenericCommand(client *c, int where); void signalListAsReady(redisDb *db, robj *key); /* MULTI/EXEC/WATCH... */ -void unwatchAllKeys(redisClient *c); -void initClientMultiState(redisClient *c); -void freeClientMultiState(redisClient *c); -void queueMultiCommand(redisClient *c); +void unwatchAllKeys(client *c); +void initClientMultiState(client *c); +void freeClientMultiState(client *c); +void queueMultiCommand(client *c); void touchWatchedKey(redisDb *db, robj *key); void touchWatchedKeysOnFlush(int dbid); -void discardTransaction(redisClient *c); -void flagTransaction(redisClient *c); +void discardTransaction(client *c); +void flagTransaction(client *c); /* Redis object implementation */ void decrRefCount(robj *o); @@ -1154,13 +1154,13 @@ robj *createIntsetObject(void); robj *createHashObject(void); robj *createZsetObject(void); robj *createZsetZiplistObject(void); -int getLongFromObjectOrReply(redisClient *c, robj *o, long *target, const char *msg); -int checkType(redisClient *c, robj *o, int type); -int getLongLongFromObjectOrReply(redisClient *c, robj *o, long long *target, const char *msg); -int getDoubleFromObjectOrReply(redisClient *c, robj *o, double *target, const char *msg); +int getLongFromObjectOrReply(client *c, robj *o, long *target, const char *msg); +int checkType(client *c, robj *o, int type); +int getLongLongFromObjectOrReply(client *c, robj *o, long long *target, const char *msg); +int getDoubleFromObjectOrReply(client *c, robj *o, double *target, const char *msg); int getLongLongFromObject(robj *o, long long *target); int getLongDoubleFromObject(robj *o, long double *target); -int getLongDoubleFromObjectOrReply(redisClient *c, robj *o, long double *target, const char *msg); +int getLongDoubleFromObjectOrReply(client *c, robj *o, long double *target, const char *msg); char *strEncoding(int encoding); int compareStringObjects(robj *a, robj *b); int collateStringObjects(robj *a, robj *b); @@ -1175,11 +1175,11 @@ ssize_t syncReadLine(int fd, char *ptr, ssize_t size, long long timeout); /* Replication */ void replicationFeedSlaves(list *slaves, int dictid, robj **argv, int argc); -void replicationFeedMonitors(redisClient *c, list *monitors, int dictid, robj **argv, int argc); +void replicationFeedMonitors(client *c, list *monitors, int dictid, robj **argv, int argc); void updateSlavesWaitingBgsave(int bgsaveerr, int type); void replicationCron(void); void replicationHandleMasterDisconnection(void); -void replicationCacheMaster(redisClient *c); +void replicationCacheMaster(client *c); void resizeReplicationBacklog(long long newsize); void replicationSetMaster(char *ip, int port); void replicationUnsetMaster(void); @@ -1189,11 +1189,11 @@ void replicationScriptCacheFlush(void); void replicationScriptCacheAdd(sds sha1); int replicationScriptCacheExists(sds sha1); void processClientsWaitingReplicas(void); -void unblockClientWaitingReplicas(redisClient *c); +void unblockClientWaitingReplicas(client *c); int replicationCountAcksByOffset(long long offset); void replicationSendNewlineToMaster(void); long long replicationGetSlaveOffset(void); -char *replicationGetSlaveName(redisClient *c); +char *replicationGetSlaveName(client *c); /* Generic persistence functions */ void startLoading(FILE *fp); @@ -1246,16 +1246,16 @@ unsigned long zslGetRank(zskiplist *zsl, double score, robj *o); /* Core functions */ int freeMemoryIfNeeded(void); -int processCommand(redisClient *c); +int processCommand(client *c); void setupSignalHandlers(void); struct redisCommand *lookupCommand(sds name); struct redisCommand *lookupCommandByCString(char *s); struct redisCommand *lookupCommandOrOriginal(sds name); -void call(redisClient *c, int flags); +void call(client *c, int flags); void propagate(struct redisCommand *cmd, int dbid, robj **argv, int argc, int flags); void alsoPropagate(struct redisCommand *cmd, int dbid, robj **argv, int argc, int target); -void forceCommandPropagation(redisClient *c, int flags); -void preventCommandPropagation(redisClient *c); +void forceCommandPropagation(client *c, int flags); +void preventCommandPropagation(client *c); int prepareForShutdown(); #ifdef __GNUC__ void serverLog(int level, const char *fmt, ...) @@ -1310,11 +1310,11 @@ void hashTypeCurrentFromZiplist(hashTypeIterator *hi, int what, long long *vll); void hashTypeCurrentFromHashTable(hashTypeIterator *hi, int what, robj **dst); robj *hashTypeCurrentObject(hashTypeIterator *hi, int what); -robj *hashTypeLookupWriteOrCreate(redisClient *c, robj *key); +robj *hashTypeLookupWriteOrCreate(client *c, robj *key); /* Pub / Sub */ -int pubsubUnsubscribeAllChannels(redisClient *c, int notify); -int pubsubUnsubscribeAllPatterns(redisClient *c, int notify); +int pubsubUnsubscribeAllChannels(client *c, int notify); +int pubsubUnsubscribeAllPatterns(client *c, int notify); void freePubsubPattern(void *p); int listMatchPubsubPattern(void *a, void *b); int pubsubPublishMessage(robj *channel, robj *message); @@ -1341,8 +1341,8 @@ void setExpire(redisDb *db, robj *key, long long when); robj *lookupKey(redisDb *db, robj *key); robj *lookupKeyRead(redisDb *db, robj *key); robj *lookupKeyWrite(redisDb *db, robj *key); -robj *lookupKeyReadOrReply(redisClient *c, robj *key, robj *reply); -robj *lookupKeyWriteOrReply(redisClient *c, robj *key, robj *reply); +robj *lookupKeyReadOrReply(client *c, robj *key, robj *reply); +robj *lookupKeyWriteOrReply(client *c, robj *key, robj *reply); void dbAdd(redisDb *db, robj *key, robj *val); void dbOverwrite(redisDb *db, robj *key, robj *val); void setKey(redisDb *db, robj *key, robj *val); @@ -1351,15 +1351,15 @@ robj *dbRandomKey(redisDb *db); int dbDelete(redisDb *db, robj *key); robj *dbUnshareStringValue(redisDb *db, robj *key, robj *o); long long emptyDb(void(callback)(void*)); -int selectDb(redisClient *c, int id); +int selectDb(client *c, int id); void signalModifiedKey(redisDb *db, robj *key); void signalFlushedDb(int dbid); unsigned int getKeysInSlot(unsigned int hashslot, robj **keys, unsigned int count); unsigned int countKeysInSlot(unsigned int hashslot); unsigned int delKeysInSlot(unsigned int hashslot); int verifyClusterConfigWithData(void); -void scanGenericCommand(redisClient *c, robj *o, unsigned long cursor); -int parseScanCursorOrReply(redisClient *c, robj *o, unsigned long *cursor); +void scanGenericCommand(client *c, robj *o, unsigned long cursor); +int parseScanCursorOrReply(client *c, robj *o, unsigned long *cursor); /* API to get key arguments from commands */ int *getKeysFromCommand(struct redisCommand *cmd, robj **argv, int argc, int *numkeys); @@ -1393,10 +1393,10 @@ void scriptingInit(void); /* Blocked clients */ void processUnblockedClients(void); -void blockClient(redisClient *c, int btype); -void unblockClient(redisClient *c); -void replyToBlockedClientTimedOut(redisClient *c); -int getTimeoutFromObjectOrReply(redisClient *c, robj *object, mstime_t *timeout, int unit); +void blockClient(client *c, int btype); +void unblockClient(client *c); +void replyToBlockedClientTimedOut(client *c); +int getTimeoutFromObjectOrReply(client *c, robj *object, mstime_t *timeout, int unit); void disconnectAllBlockedClients(void); /* Git SHA1 */ @@ -1405,173 +1405,173 @@ char *redisGitDirty(void); uint64_t redisBuildId(void); /* Commands prototypes */ -void authCommand(redisClient *c); -void pingCommand(redisClient *c); -void echoCommand(redisClient *c); -void commandCommand(redisClient *c); -void setCommand(redisClient *c); -void setnxCommand(redisClient *c); -void setexCommand(redisClient *c); -void psetexCommand(redisClient *c); -void getCommand(redisClient *c); -void delCommand(redisClient *c); -void existsCommand(redisClient *c); -void setbitCommand(redisClient *c); -void getbitCommand(redisClient *c); -void setrangeCommand(redisClient *c); -void getrangeCommand(redisClient *c); -void incrCommand(redisClient *c); -void decrCommand(redisClient *c); -void incrbyCommand(redisClient *c); -void decrbyCommand(redisClient *c); -void incrbyfloatCommand(redisClient *c); -void selectCommand(redisClient *c); -void randomkeyCommand(redisClient *c); -void keysCommand(redisClient *c); -void scanCommand(redisClient *c); -void dbsizeCommand(redisClient *c); -void lastsaveCommand(redisClient *c); -void saveCommand(redisClient *c); -void bgsaveCommand(redisClient *c); -void bgrewriteaofCommand(redisClient *c); -void shutdownCommand(redisClient *c); -void moveCommand(redisClient *c); -void renameCommand(redisClient *c); -void renamenxCommand(redisClient *c); -void lpushCommand(redisClient *c); -void rpushCommand(redisClient *c); -void lpushxCommand(redisClient *c); -void rpushxCommand(redisClient *c); -void linsertCommand(redisClient *c); -void lpopCommand(redisClient *c); -void rpopCommand(redisClient *c); -void llenCommand(redisClient *c); -void lindexCommand(redisClient *c); -void lrangeCommand(redisClient *c); -void ltrimCommand(redisClient *c); -void typeCommand(redisClient *c); -void lsetCommand(redisClient *c); -void saddCommand(redisClient *c); -void sremCommand(redisClient *c); -void smoveCommand(redisClient *c); -void sismemberCommand(redisClient *c); -void scardCommand(redisClient *c); -void spopCommand(redisClient *c); -void srandmemberCommand(redisClient *c); -void sinterCommand(redisClient *c); -void sinterstoreCommand(redisClient *c); -void sunionCommand(redisClient *c); -void sunionstoreCommand(redisClient *c); -void sdiffCommand(redisClient *c); -void sdiffstoreCommand(redisClient *c); -void sscanCommand(redisClient *c); -void syncCommand(redisClient *c); -void flushdbCommand(redisClient *c); -void flushallCommand(redisClient *c); -void sortCommand(redisClient *c); -void lremCommand(redisClient *c); -void rpoplpushCommand(redisClient *c); -void infoCommand(redisClient *c); -void mgetCommand(redisClient *c); -void monitorCommand(redisClient *c); -void expireCommand(redisClient *c); -void expireatCommand(redisClient *c); -void pexpireCommand(redisClient *c); -void pexpireatCommand(redisClient *c); -void getsetCommand(redisClient *c); -void ttlCommand(redisClient *c); -void pttlCommand(redisClient *c); -void persistCommand(redisClient *c); -void slaveofCommand(redisClient *c); -void roleCommand(redisClient *c); -void debugCommand(redisClient *c); -void msetCommand(redisClient *c); -void msetnxCommand(redisClient *c); -void zaddCommand(redisClient *c); -void zincrbyCommand(redisClient *c); -void zrangeCommand(redisClient *c); -void zrangebyscoreCommand(redisClient *c); -void zrevrangebyscoreCommand(redisClient *c); -void zrangebylexCommand(redisClient *c); -void zrevrangebylexCommand(redisClient *c); -void zcountCommand(redisClient *c); -void zlexcountCommand(redisClient *c); -void zrevrangeCommand(redisClient *c); -void zcardCommand(redisClient *c); -void zremCommand(redisClient *c); -void zscoreCommand(redisClient *c); -void zremrangebyscoreCommand(redisClient *c); -void zremrangebylexCommand(redisClient *c); -void multiCommand(redisClient *c); -void execCommand(redisClient *c); -void discardCommand(redisClient *c); -void blpopCommand(redisClient *c); -void brpopCommand(redisClient *c); -void brpoplpushCommand(redisClient *c); -void appendCommand(redisClient *c); -void strlenCommand(redisClient *c); -void zrankCommand(redisClient *c); -void zrevrankCommand(redisClient *c); -void hsetCommand(redisClient *c); -void hsetnxCommand(redisClient *c); -void hgetCommand(redisClient *c); -void hmsetCommand(redisClient *c); -void hmgetCommand(redisClient *c); -void hdelCommand(redisClient *c); -void hlenCommand(redisClient *c); -void hstrlenCommand(redisClient *c); -void zremrangebyrankCommand(redisClient *c); -void zunionstoreCommand(redisClient *c); -void zinterstoreCommand(redisClient *c); -void zscanCommand(redisClient *c); -void hkeysCommand(redisClient *c); -void hvalsCommand(redisClient *c); -void hgetallCommand(redisClient *c); -void hexistsCommand(redisClient *c); -void hscanCommand(redisClient *c); -void configCommand(redisClient *c); -void hincrbyCommand(redisClient *c); -void hincrbyfloatCommand(redisClient *c); -void subscribeCommand(redisClient *c); -void unsubscribeCommand(redisClient *c); -void psubscribeCommand(redisClient *c); -void punsubscribeCommand(redisClient *c); -void publishCommand(redisClient *c); -void pubsubCommand(redisClient *c); -void watchCommand(redisClient *c); -void unwatchCommand(redisClient *c); -void clusterCommand(redisClient *c); -void restoreCommand(redisClient *c); -void migrateCommand(redisClient *c); -void askingCommand(redisClient *c); -void readonlyCommand(redisClient *c); -void readwriteCommand(redisClient *c); -void dumpCommand(redisClient *c); -void objectCommand(redisClient *c); -void clientCommand(redisClient *c); -void evalCommand(redisClient *c); -void evalShaCommand(redisClient *c); -void scriptCommand(redisClient *c); -void timeCommand(redisClient *c); -void bitopCommand(redisClient *c); -void bitcountCommand(redisClient *c); -void bitposCommand(redisClient *c); -void replconfCommand(redisClient *c); -void waitCommand(redisClient *c); -void geoencodeCommand(redisClient *c); -void geodecodeCommand(redisClient *c); -void georadiusByMemberCommand(redisClient *c); -void georadiusCommand(redisClient *c); -void geoaddCommand(redisClient *c); -void geohashCommand(redisClient *c); -void geoposCommand(redisClient *c); -void geodistCommand(redisClient *c); -void pfselftestCommand(redisClient *c); -void pfaddCommand(redisClient *c); -void pfcountCommand(redisClient *c); -void pfmergeCommand(redisClient *c); -void pfdebugCommand(redisClient *c); -void latencyCommand(redisClient *c); +void authCommand(client *c); +void pingCommand(client *c); +void echoCommand(client *c); +void commandCommand(client *c); +void setCommand(client *c); +void setnxCommand(client *c); +void setexCommand(client *c); +void psetexCommand(client *c); +void getCommand(client *c); +void delCommand(client *c); +void existsCommand(client *c); +void setbitCommand(client *c); +void getbitCommand(client *c); +void setrangeCommand(client *c); +void getrangeCommand(client *c); +void incrCommand(client *c); +void decrCommand(client *c); +void incrbyCommand(client *c); +void decrbyCommand(client *c); +void incrbyfloatCommand(client *c); +void selectCommand(client *c); +void randomkeyCommand(client *c); +void keysCommand(client *c); +void scanCommand(client *c); +void dbsizeCommand(client *c); +void lastsaveCommand(client *c); +void saveCommand(client *c); +void bgsaveCommand(client *c); +void bgrewriteaofCommand(client *c); +void shutdownCommand(client *c); +void moveCommand(client *c); +void renameCommand(client *c); +void renamenxCommand(client *c); +void lpushCommand(client *c); +void rpushCommand(client *c); +void lpushxCommand(client *c); +void rpushxCommand(client *c); +void linsertCommand(client *c); +void lpopCommand(client *c); +void rpopCommand(client *c); +void llenCommand(client *c); +void lindexCommand(client *c); +void lrangeCommand(client *c); +void ltrimCommand(client *c); +void typeCommand(client *c); +void lsetCommand(client *c); +void saddCommand(client *c); +void sremCommand(client *c); +void smoveCommand(client *c); +void sismemberCommand(client *c); +void scardCommand(client *c); +void spopCommand(client *c); +void srandmemberCommand(client *c); +void sinterCommand(client *c); +void sinterstoreCommand(client *c); +void sunionCommand(client *c); +void sunionstoreCommand(client *c); +void sdiffCommand(client *c); +void sdiffstoreCommand(client *c); +void sscanCommand(client *c); +void syncCommand(client *c); +void flushdbCommand(client *c); +void flushallCommand(client *c); +void sortCommand(client *c); +void lremCommand(client *c); +void rpoplpushCommand(client *c); +void infoCommand(client *c); +void mgetCommand(client *c); +void monitorCommand(client *c); +void expireCommand(client *c); +void expireatCommand(client *c); +void pexpireCommand(client *c); +void pexpireatCommand(client *c); +void getsetCommand(client *c); +void ttlCommand(client *c); +void pttlCommand(client *c); +void persistCommand(client *c); +void slaveofCommand(client *c); +void roleCommand(client *c); +void debugCommand(client *c); +void msetCommand(client *c); +void msetnxCommand(client *c); +void zaddCommand(client *c); +void zincrbyCommand(client *c); +void zrangeCommand(client *c); +void zrangebyscoreCommand(client *c); +void zrevrangebyscoreCommand(client *c); +void zrangebylexCommand(client *c); +void zrevrangebylexCommand(client *c); +void zcountCommand(client *c); +void zlexcountCommand(client *c); +void zrevrangeCommand(client *c); +void zcardCommand(client *c); +void zremCommand(client *c); +void zscoreCommand(client *c); +void zremrangebyscoreCommand(client *c); +void zremrangebylexCommand(client *c); +void multiCommand(client *c); +void execCommand(client *c); +void discardCommand(client *c); +void blpopCommand(client *c); +void brpopCommand(client *c); +void brpoplpushCommand(client *c); +void appendCommand(client *c); +void strlenCommand(client *c); +void zrankCommand(client *c); +void zrevrankCommand(client *c); +void hsetCommand(client *c); +void hsetnxCommand(client *c); +void hgetCommand(client *c); +void hmsetCommand(client *c); +void hmgetCommand(client *c); +void hdelCommand(client *c); +void hlenCommand(client *c); +void hstrlenCommand(client *c); +void zremrangebyrankCommand(client *c); +void zunionstoreCommand(client *c); +void zinterstoreCommand(client *c); +void zscanCommand(client *c); +void hkeysCommand(client *c); +void hvalsCommand(client *c); +void hgetallCommand(client *c); +void hexistsCommand(client *c); +void hscanCommand(client *c); +void configCommand(client *c); +void hincrbyCommand(client *c); +void hincrbyfloatCommand(client *c); +void subscribeCommand(client *c); +void unsubscribeCommand(client *c); +void psubscribeCommand(client *c); +void punsubscribeCommand(client *c); +void publishCommand(client *c); +void pubsubCommand(client *c); +void watchCommand(client *c); +void unwatchCommand(client *c); +void clusterCommand(client *c); +void restoreCommand(client *c); +void migrateCommand(client *c); +void askingCommand(client *c); +void readonlyCommand(client *c); +void readwriteCommand(client *c); +void dumpCommand(client *c); +void objectCommand(client *c); +void clientCommand(client *c); +void evalCommand(client *c); +void evalShaCommand(client *c); +void scriptCommand(client *c); +void timeCommand(client *c); +void bitopCommand(client *c); +void bitcountCommand(client *c); +void bitposCommand(client *c); +void replconfCommand(client *c); +void waitCommand(client *c); +void geoencodeCommand(client *c); +void geodecodeCommand(client *c); +void georadiusByMemberCommand(client *c); +void georadiusCommand(client *c); +void geoaddCommand(client *c); +void geohashCommand(client *c); +void geoposCommand(client *c); +void geodistCommand(client *c); +void pfselftestCommand(client *c); +void pfaddCommand(client *c); +void pfcountCommand(client *c); +void pfmergeCommand(client *c); +void pfdebugCommand(client *c); +void latencyCommand(client *c); #if defined(__GNUC__) void *calloc(size_t count, size_t size) __attribute__ ((deprecated)); @@ -1581,7 +1581,7 @@ void *realloc(void *ptr, size_t size) __attribute__ ((deprecated)); #endif /* Debugging stuff */ -void _redisAssertWithInfo(redisClient *c, robj *o, char *estr, char *file, int line); +void _redisAssertWithInfo(client *c, robj *o, char *estr, char *file, int line); void _redisAssert(char *estr, char *file, int line); void _redisPanic(char *msg, char *file, int line); void bugReportStart(void); diff --git a/src/slowlog.c b/src/slowlog.c index a88967ae1..7df37d26e 100644 --- a/src/slowlog.c +++ b/src/slowlog.c @@ -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); diff --git a/src/slowlog.h b/src/slowlog.h index e3067de91..81df0b054 100644 --- a/src/slowlog.h +++ b/src/slowlog.h @@ -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); diff --git a/src/sort.c b/src/sort.c index 026f90002..2bdea56bd 100644 --- a/src/sort.c +++ b/src/sort.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; diff --git a/src/t_hash.c b/src/t_hash.c index 8754f3182..9d0cfee1e 100644 --- a/src/t_hash.c +++ b/src/t_hash.c @@ -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; diff --git a/src/t_list.c b/src/t_list.c index 93f5f7058..638290ead 100644 --- a/src/t_list.c +++ b/src/t_list.c @@ -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) diff --git a/src/t_set.c b/src/t_set.c index 746d0f19c..6736fb844 100644 --- a/src/t_set.c +++ b/src/t_set.c @@ -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; diff --git a/src/t_string.c b/src/t_string.c index c0e86d4df..5cc428ec4 100644 --- a/src/t_string.c +++ b/src/t_string.c @@ -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; diff --git a/src/t_zset.c b/src/t_zset.c index 3380832d9..790073e26 100644 --- a/src/t_zset.c +++ b/src/t_zset.c @@ -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; |