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

RDMF: use client instead of redisClient, like Disque.

parent 424fe9af
...@@ -528,7 +528,7 @@ typedef struct readyList { ...@@ -528,7 +528,7 @@ typedef struct readyList {
/* With multiplexing we need to take per-client state. /* With multiplexing we need to take per-client state.
* Clients are taken in a linked list. */ * Clients are taken in a linked list. */
typedef struct redisClient { typedef struct client {
uint64_t id; /* Client incremental unique ID. */ uint64_t id; /* Client incremental unique ID. */
int fd; int fd;
redisDb *db; redisDb *db;
...@@ -574,7 +574,7 @@ typedef struct redisClient { ...@@ -574,7 +574,7 @@ typedef struct redisClient {
/* Response buffer */ /* Response buffer */
int bufpos; int bufpos;
char buf[REDIS_REPLY_CHUNK_BYTES]; char buf[REDIS_REPLY_CHUNK_BYTES];
} redisClient; } client;
struct saveparam { struct saveparam {
time_t seconds; time_t seconds;
...@@ -695,7 +695,7 @@ struct redisServer { ...@@ -695,7 +695,7 @@ struct redisServer {
list *clients; /* List of active clients */ list *clients; /* List of active clients */
list *clients_to_close; /* Clients to close asynchronously */ list *clients_to_close; /* Clients to close asynchronously */
list *slaves, *monitors; /* List of slaves and MONITORs */ 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 */ int clients_paused; /* True if clients are currently paused */
mstime_t clients_pause_end_time; /* Time when we undo clients_paused */ mstime_t clients_pause_end_time; /* Time when we undo clients_paused */
char neterr[ANET_ERR_LEN]; /* Error buffer for anet.c */ char neterr[ANET_ERR_LEN]; /* Error buffer for anet.c */
...@@ -835,8 +835,8 @@ struct redisServer { ...@@ -835,8 +835,8 @@ struct redisServer {
char *masterhost; /* Hostname of master */ char *masterhost; /* Hostname of master */
int masterport; /* Port of master */ int masterport; /* Port of master */
int repl_timeout; /* Timeout after N seconds of master idle */ int repl_timeout; /* Timeout after N seconds of master idle */
redisClient *master; /* Client that is master for this slave */ client *master; /* Client that is master for this slave */
redisClient *cached_master; /* Cached master to be reused for PSYNC. */ client *cached_master; /* Cached master to be reused for PSYNC. */
int repl_syncio_timeout; /* Timeout for synchronous I/O calls */ int repl_syncio_timeout; /* Timeout for synchronous I/O calls */
int repl_state; /* Replication status if the instance is a slave */ 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. */ off_t repl_transfer_size; /* Size of RDB to read from master during sync. */
...@@ -904,8 +904,8 @@ struct redisServer { ...@@ -904,8 +904,8 @@ struct redisServer {
there is at least an uncovered slot. */ there is at least an uncovered slot. */
/* Scripting */ /* Scripting */
lua_State *lua; /* The Lua interpreter. We use just one for all clients */ lua_State *lua; /* The Lua interpreter. We use just one for all clients */
redisClient *lua_client; /* The "fake client" to query Redis from Lua */ client *lua_client; /* The "fake client" to query Redis from Lua */
redisClient *lua_caller; /* The client running EVAL right now, or NULL */ client *lua_caller; /* The client running EVAL right now, or NULL */
dict *lua_scripts; /* A dictionary of SHA1 -> Lua scripts */ dict *lua_scripts; /* A dictionary of SHA1 -> Lua scripts */
mstime_t lua_time_limit; /* Script timeout in milliseconds */ mstime_t lua_time_limit; /* Script timeout in milliseconds */
mstime_t lua_time_start; /* Start time of script, milliseconds time */ mstime_t lua_time_start; /* Start time of script, milliseconds time */
...@@ -930,11 +930,11 @@ struct redisServer { ...@@ -930,11 +930,11 @@ struct redisServer {
}; };
typedef struct pubsubPattern { typedef struct pubsubPattern {
redisClient *client; client *client;
robj *pattern; robj *pattern;
} pubsubPattern; } pubsubPattern;
typedef void redisCommandProc(redisClient *c); typedef void redisCommandProc(client *c);
typedef int *redisGetKeysProc(struct redisCommand *cmd, robj **argv, int argc, int *numkeys); typedef int *redisGetKeysProc(struct redisCommand *cmd, robj **argv, int argc, int *numkeys);
struct redisCommand { struct redisCommand {
char *name; char *name;
...@@ -1039,46 +1039,46 @@ size_t redisPopcount(void *s, long count); ...@@ -1039,46 +1039,46 @@ size_t redisPopcount(void *s, long count);
void redisSetProcTitle(char *title); void redisSetProcTitle(char *title);
/* networking.c -- Networking and Client related operations */ /* networking.c -- Networking and Client related operations */
redisClient *createClient(int fd); client *createClient(int fd);
void closeTimedoutClients(void); void closeTimedoutClients(void);
void freeClient(redisClient *c); void freeClient(client *c);
void freeClientAsync(redisClient *c); void freeClientAsync(client *c);
void resetClient(redisClient *c); void resetClient(client *c);
void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask); void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask);
void *addDeferredMultiBulkLength(redisClient *c); void *addDeferredMultiBulkLength(client *c);
void setDeferredMultiBulkLength(redisClient *c, void *node, long length); void setDeferredMultiBulkLength(client *c, void *node, long length);
void processInputBuffer(redisClient *c); void processInputBuffer(client *c);
void acceptHandler(aeEventLoop *el, int fd, void *privdata, int mask); void acceptHandler(aeEventLoop *el, int fd, void *privdata, int mask);
void acceptTcpHandler(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 acceptUnixHandler(aeEventLoop *el, int fd, void *privdata, int mask);
void readQueryFromClient(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 addReplyBulk(client *c, robj *obj);
void addReplyBulkCString(redisClient *c, const char *s); void addReplyBulkCString(client *c, const char *s);
void addReplyBulkCBuffer(redisClient *c, const void *p, size_t len); void addReplyBulkCBuffer(client *c, const void *p, size_t len);
void addReplyBulkLongLong(redisClient *c, long long ll); void addReplyBulkLongLong(client *c, long long ll);
void addReply(redisClient *c, robj *obj); void addReply(client *c, robj *obj);
void addReplySds(redisClient *c, sds s); void addReplySds(client *c, sds s);
void addReplyBulkSds(redisClient *c, sds s); void addReplyBulkSds(client *c, sds s);
void addReplyError(redisClient *c, const char *err); void addReplyError(client *c, const char *err);
void addReplyStatus(redisClient *c, const char *status); void addReplyStatus(client *c, const char *status);
void addReplyDouble(redisClient *c, double d); void addReplyDouble(client *c, double d);
void addReplyLongLong(redisClient *c, long long ll); void addReplyLongLong(client *c, long long ll);
void addReplyMultiBulkLen(redisClient *c, long length); void addReplyMultiBulkLen(client *c, long length);
void copyClientOutputBuffer(redisClient *dst, redisClient *src); void copyClientOutputBuffer(client *dst, client *src);
void *dupClientReplyValue(void *o); void *dupClientReplyValue(void *o);
void getClientsMaxBuffers(unsigned long *longest_output_list, void getClientsMaxBuffers(unsigned long *longest_output_list,
unsigned long *biggest_input_buffer); unsigned long *biggest_input_buffer);
void formatPeerId(char *peerid, size_t peerid_len, char *ip, int port); void formatPeerId(char *peerid, size_t peerid_len, char *ip, int port);
char *getClientPeerId(redisClient *client); char *getClientPeerId(client *client);
sds catClientInfoString(sds s, redisClient *client); sds catClientInfoString(sds s, client *client);
sds getAllClientsInfoString(void); sds getAllClientsInfoString(void);
void rewriteClientCommandVector(redisClient *c, int argc, ...); void rewriteClientCommandVector(client *c, int argc, ...);
void rewriteClientCommandArgument(redisClient *c, int i, robj *newval); void rewriteClientCommandArgument(client *c, int i, robj *newval);
void replaceClientCommandVector(redisClient *c, int argc, robj **argv); void replaceClientCommandVector(client *c, int argc, robj **argv);
unsigned long getClientOutputBufferMemoryUsage(redisClient *c); unsigned long getClientOutputBufferMemoryUsage(client *c);
void freeClientsInAsyncFreeQueue(void); void freeClientsInAsyncFreeQueue(void);
void asyncCloseClientOnOutputBufferLimitReached(redisClient *c); void asyncCloseClientOnOutputBufferLimitReached(client *c);
int getClientType(redisClient *c); int getClientType(client *c);
int getClientTypeByName(char *name); int getClientTypeByName(char *name);
char *getClientTypeName(int class); char *getClientTypeName(int class);
void flushSlavesOutputBuffers(void); void flushSlavesOutputBuffers(void);
...@@ -1089,13 +1089,13 @@ int clientsArePaused(void); ...@@ -1089,13 +1089,13 @@ int clientsArePaused(void);
int processEventsWhileBlocked(void); int processEventsWhileBlocked(void);
#ifdef __GNUC__ #ifdef __GNUC__
void addReplyErrorFormat(redisClient *c, const char *fmt, ...) void addReplyErrorFormat(client *c, const char *fmt, ...)
__attribute__((format(printf, 2, 3))); __attribute__((format(printf, 2, 3)));
void addReplyStatusFormat(redisClient *c, const char *fmt, ...) void addReplyStatusFormat(client *c, const char *fmt, ...)
__attribute__((format(printf, 2, 3))); __attribute__((format(printf, 2, 3)));
#else #else
void addReplyErrorFormat(redisClient *c, const char *fmt, ...); void addReplyErrorFormat(client *c, const char *fmt, ...);
void addReplyStatusFormat(redisClient *c, const char *fmt, ...); void addReplyStatusFormat(client *c, const char *fmt, ...);
#endif #endif
/* List data type */ /* List data type */
...@@ -1111,20 +1111,20 @@ void listTypeInsert(listTypeEntry *entry, robj *value, int where); ...@@ -1111,20 +1111,20 @@ void listTypeInsert(listTypeEntry *entry, robj *value, int where);
int listTypeEqual(listTypeEntry *entry, robj *o); int listTypeEqual(listTypeEntry *entry, robj *o);
void listTypeDelete(listTypeIterator *iter, listTypeEntry *entry); void listTypeDelete(listTypeIterator *iter, listTypeEntry *entry);
void listTypeConvert(robj *subject, int enc); void listTypeConvert(robj *subject, int enc);
void unblockClientWaitingData(redisClient *c); void unblockClientWaitingData(client *c);
void handleClientsBlockedOnLists(void); void handleClientsBlockedOnLists(void);
void popGenericCommand(redisClient *c, int where); void popGenericCommand(client *c, int where);
void signalListAsReady(redisDb *db, robj *key); void signalListAsReady(redisDb *db, robj *key);
/* MULTI/EXEC/WATCH... */ /* MULTI/EXEC/WATCH... */
void unwatchAllKeys(redisClient *c); void unwatchAllKeys(client *c);
void initClientMultiState(redisClient *c); void initClientMultiState(client *c);
void freeClientMultiState(redisClient *c); void freeClientMultiState(client *c);
void queueMultiCommand(redisClient *c); void queueMultiCommand(client *c);
void touchWatchedKey(redisDb *db, robj *key); void touchWatchedKey(redisDb *db, robj *key);
void touchWatchedKeysOnFlush(int dbid); void touchWatchedKeysOnFlush(int dbid);
void discardTransaction(redisClient *c); void discardTransaction(client *c);
void flagTransaction(redisClient *c); void flagTransaction(client *c);
/* Redis object implementation */ /* Redis object implementation */
void decrRefCount(robj *o); void decrRefCount(robj *o);
...@@ -1154,13 +1154,13 @@ robj *createIntsetObject(void); ...@@ -1154,13 +1154,13 @@ robj *createIntsetObject(void);
robj *createHashObject(void); robj *createHashObject(void);
robj *createZsetObject(void); robj *createZsetObject(void);
robj *createZsetZiplistObject(void); robj *createZsetZiplistObject(void);
int getLongFromObjectOrReply(redisClient *c, robj *o, long *target, const char *msg); int getLongFromObjectOrReply(client *c, robj *o, long *target, const char *msg);
int checkType(redisClient *c, robj *o, int type); int checkType(client *c, robj *o, int type);
int getLongLongFromObjectOrReply(redisClient *c, robj *o, long long *target, const char *msg); int getLongLongFromObjectOrReply(client *c, robj *o, long long *target, const char *msg);
int getDoubleFromObjectOrReply(redisClient *c, robj *o, double *target, const char *msg); int getDoubleFromObjectOrReply(client *c, robj *o, double *target, const char *msg);
int getLongLongFromObject(robj *o, long long *target); int getLongLongFromObject(robj *o, long long *target);
int getLongDoubleFromObject(robj *o, long double *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); char *strEncoding(int encoding);
int compareStringObjects(robj *a, robj *b); int compareStringObjects(robj *a, robj *b);
int collateStringObjects(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); ...@@ -1175,11 +1175,11 @@ ssize_t syncReadLine(int fd, char *ptr, ssize_t size, long long timeout);
/* Replication */ /* Replication */
void replicationFeedSlaves(list *slaves, int dictid, robj **argv, int argc); 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 updateSlavesWaitingBgsave(int bgsaveerr, int type);
void replicationCron(void); void replicationCron(void);
void replicationHandleMasterDisconnection(void); void replicationHandleMasterDisconnection(void);
void replicationCacheMaster(redisClient *c); void replicationCacheMaster(client *c);
void resizeReplicationBacklog(long long newsize); void resizeReplicationBacklog(long long newsize);
void replicationSetMaster(char *ip, int port); void replicationSetMaster(char *ip, int port);
void replicationUnsetMaster(void); void replicationUnsetMaster(void);
...@@ -1189,11 +1189,11 @@ void replicationScriptCacheFlush(void); ...@@ -1189,11 +1189,11 @@ void replicationScriptCacheFlush(void);
void replicationScriptCacheAdd(sds sha1); void replicationScriptCacheAdd(sds sha1);
int replicationScriptCacheExists(sds sha1); int replicationScriptCacheExists(sds sha1);
void processClientsWaitingReplicas(void); void processClientsWaitingReplicas(void);
void unblockClientWaitingReplicas(redisClient *c); void unblockClientWaitingReplicas(client *c);
int replicationCountAcksByOffset(long long offset); int replicationCountAcksByOffset(long long offset);
void replicationSendNewlineToMaster(void); void replicationSendNewlineToMaster(void);
long long replicationGetSlaveOffset(void); long long replicationGetSlaveOffset(void);
char *replicationGetSlaveName(redisClient *c); char *replicationGetSlaveName(client *c);
/* Generic persistence functions */ /* Generic persistence functions */
void startLoading(FILE *fp); void startLoading(FILE *fp);
...@@ -1246,16 +1246,16 @@ unsigned long zslGetRank(zskiplist *zsl, double score, robj *o); ...@@ -1246,16 +1246,16 @@ unsigned long zslGetRank(zskiplist *zsl, double score, robj *o);
/* Core functions */ /* Core functions */
int freeMemoryIfNeeded(void); int freeMemoryIfNeeded(void);
int processCommand(redisClient *c); int processCommand(client *c);
void setupSignalHandlers(void); void setupSignalHandlers(void);
struct redisCommand *lookupCommand(sds name); struct redisCommand *lookupCommand(sds name);
struct redisCommand *lookupCommandByCString(char *s); struct redisCommand *lookupCommandByCString(char *s);
struct redisCommand *lookupCommandOrOriginal(sds name); 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 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 alsoPropagate(struct redisCommand *cmd, int dbid, robj **argv, int argc, int target);
void forceCommandPropagation(redisClient *c, int flags); void forceCommandPropagation(client *c, int flags);
void preventCommandPropagation(redisClient *c); void preventCommandPropagation(client *c);
int prepareForShutdown(); int prepareForShutdown();
#ifdef __GNUC__ #ifdef __GNUC__
void serverLog(int level, const char *fmt, ...) void serverLog(int level, const char *fmt, ...)
...@@ -1310,11 +1310,11 @@ void hashTypeCurrentFromZiplist(hashTypeIterator *hi, int what, ...@@ -1310,11 +1310,11 @@ void hashTypeCurrentFromZiplist(hashTypeIterator *hi, int what,
long long *vll); long long *vll);
void hashTypeCurrentFromHashTable(hashTypeIterator *hi, int what, robj **dst); void hashTypeCurrentFromHashTable(hashTypeIterator *hi, int what, robj **dst);
robj *hashTypeCurrentObject(hashTypeIterator *hi, int what); robj *hashTypeCurrentObject(hashTypeIterator *hi, int what);
robj *hashTypeLookupWriteOrCreate(redisClient *c, robj *key); robj *hashTypeLookupWriteOrCreate(client *c, robj *key);
/* Pub / Sub */ /* Pub / Sub */
int pubsubUnsubscribeAllChannels(redisClient *c, int notify); int pubsubUnsubscribeAllChannels(client *c, int notify);
int pubsubUnsubscribeAllPatterns(redisClient *c, int notify); int pubsubUnsubscribeAllPatterns(client *c, int notify);
void freePubsubPattern(void *p); void freePubsubPattern(void *p);
int listMatchPubsubPattern(void *a, void *b); int listMatchPubsubPattern(void *a, void *b);
int pubsubPublishMessage(robj *channel, robj *message); int pubsubPublishMessage(robj *channel, robj *message);
...@@ -1341,8 +1341,8 @@ void setExpire(redisDb *db, robj *key, long long when); ...@@ -1341,8 +1341,8 @@ void setExpire(redisDb *db, robj *key, long long when);
robj *lookupKey(redisDb *db, robj *key); robj *lookupKey(redisDb *db, robj *key);
robj *lookupKeyRead(redisDb *db, robj *key); robj *lookupKeyRead(redisDb *db, robj *key);
robj *lookupKeyWrite(redisDb *db, robj *key); robj *lookupKeyWrite(redisDb *db, robj *key);
robj *lookupKeyReadOrReply(redisClient *c, robj *key, robj *reply); robj *lookupKeyReadOrReply(client *c, robj *key, robj *reply);
robj *lookupKeyWriteOrReply(redisClient *c, robj *key, robj *reply); robj *lookupKeyWriteOrReply(client *c, robj *key, robj *reply);
void dbAdd(redisDb *db, robj *key, robj *val); void dbAdd(redisDb *db, robj *key, robj *val);
void dbOverwrite(redisDb *db, robj *key, robj *val); void dbOverwrite(redisDb *db, robj *key, robj *val);
void setKey(redisDb *db, robj *key, robj *val); void setKey(redisDb *db, robj *key, robj *val);
...@@ -1351,15 +1351,15 @@ robj *dbRandomKey(redisDb *db); ...@@ -1351,15 +1351,15 @@ robj *dbRandomKey(redisDb *db);
int dbDelete(redisDb *db, robj *key); int dbDelete(redisDb *db, robj *key);
robj *dbUnshareStringValue(redisDb *db, robj *key, robj *o); robj *dbUnshareStringValue(redisDb *db, robj *key, robj *o);
long long emptyDb(void(callback)(void*)); 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 signalModifiedKey(redisDb *db, robj *key);
void signalFlushedDb(int dbid); void signalFlushedDb(int dbid);
unsigned int getKeysInSlot(unsigned int hashslot, robj **keys, unsigned int count); unsigned int getKeysInSlot(unsigned int hashslot, robj **keys, unsigned int count);
unsigned int countKeysInSlot(unsigned int hashslot); unsigned int countKeysInSlot(unsigned int hashslot);
unsigned int delKeysInSlot(unsigned int hashslot); unsigned int delKeysInSlot(unsigned int hashslot);
int verifyClusterConfigWithData(void); int verifyClusterConfigWithData(void);
void scanGenericCommand(redisClient *c, robj *o, unsigned long cursor); void scanGenericCommand(client *c, robj *o, unsigned long cursor);
int parseScanCursorOrReply(redisClient *c, robj *o, unsigned long *cursor); int parseScanCursorOrReply(client *c, robj *o, unsigned long *cursor);
/* API to get key arguments from commands */ /* API to get key arguments from commands */
int *getKeysFromCommand(struct redisCommand *cmd, robj **argv, int argc, int *numkeys); int *getKeysFromCommand(struct redisCommand *cmd, robj **argv, int argc, int *numkeys);
...@@ -1393,10 +1393,10 @@ void scriptingInit(void); ...@@ -1393,10 +1393,10 @@ void scriptingInit(void);
/* Blocked clients */ /* Blocked clients */
void processUnblockedClients(void); void processUnblockedClients(void);
void blockClient(redisClient *c, int btype); void blockClient(client *c, int btype);
void unblockClient(redisClient *c); void unblockClient(client *c);
void replyToBlockedClientTimedOut(redisClient *c); void replyToBlockedClientTimedOut(client *c);
int getTimeoutFromObjectOrReply(redisClient *c, robj *object, mstime_t *timeout, int unit); int getTimeoutFromObjectOrReply(client *c, robj *object, mstime_t *timeout, int unit);
void disconnectAllBlockedClients(void); void disconnectAllBlockedClients(void);
/* Git SHA1 */ /* Git SHA1 */
...@@ -1405,173 +1405,173 @@ char *redisGitDirty(void); ...@@ -1405,173 +1405,173 @@ char *redisGitDirty(void);
uint64_t redisBuildId(void); uint64_t redisBuildId(void);
/* Commands prototypes */ /* Commands prototypes */
void authCommand(redisClient *c); void authCommand(client *c);
void pingCommand(redisClient *c); void pingCommand(client *c);
void echoCommand(redisClient *c); void echoCommand(client *c);
void commandCommand(redisClient *c); void commandCommand(client *c);
void setCommand(redisClient *c); void setCommand(client *c);
void setnxCommand(redisClient *c); void setnxCommand(client *c);
void setexCommand(redisClient *c); void setexCommand(client *c);
void psetexCommand(redisClient *c); void psetexCommand(client *c);
void getCommand(redisClient *c); void getCommand(client *c);
void delCommand(redisClient *c); void delCommand(client *c);
void existsCommand(redisClient *c); void existsCommand(client *c);
void setbitCommand(redisClient *c); void setbitCommand(client *c);
void getbitCommand(redisClient *c); void getbitCommand(client *c);
void setrangeCommand(redisClient *c); void setrangeCommand(client *c);
void getrangeCommand(redisClient *c); void getrangeCommand(client *c);
void incrCommand(redisClient *c); void incrCommand(client *c);
void decrCommand(redisClient *c); void decrCommand(client *c);
void incrbyCommand(redisClient *c); void incrbyCommand(client *c);
void decrbyCommand(redisClient *c); void decrbyCommand(client *c);
void incrbyfloatCommand(redisClient *c); void incrbyfloatCommand(client *c);
void selectCommand(redisClient *c); void selectCommand(client *c);
void randomkeyCommand(redisClient *c); void randomkeyCommand(client *c);
void keysCommand(redisClient *c); void keysCommand(client *c);
void scanCommand(redisClient *c); void scanCommand(client *c);
void dbsizeCommand(redisClient *c); void dbsizeCommand(client *c);
void lastsaveCommand(redisClient *c); void lastsaveCommand(client *c);
void saveCommand(redisClient *c); void saveCommand(client *c);
void bgsaveCommand(redisClient *c); void bgsaveCommand(client *c);
void bgrewriteaofCommand(redisClient *c); void bgrewriteaofCommand(client *c);
void shutdownCommand(redisClient *c); void shutdownCommand(client *c);
void moveCommand(redisClient *c); void moveCommand(client *c);
void renameCommand(redisClient *c); void renameCommand(client *c);
void renamenxCommand(redisClient *c); void renamenxCommand(client *c);
void lpushCommand(redisClient *c); void lpushCommand(client *c);
void rpushCommand(redisClient *c); void rpushCommand(client *c);
void lpushxCommand(redisClient *c); void lpushxCommand(client *c);
void rpushxCommand(redisClient *c); void rpushxCommand(client *c);
void linsertCommand(redisClient *c); void linsertCommand(client *c);
void lpopCommand(redisClient *c); void lpopCommand(client *c);
void rpopCommand(redisClient *c); void rpopCommand(client *c);
void llenCommand(redisClient *c); void llenCommand(client *c);
void lindexCommand(redisClient *c); void lindexCommand(client *c);
void lrangeCommand(redisClient *c); void lrangeCommand(client *c);
void ltrimCommand(redisClient *c); void ltrimCommand(client *c);
void typeCommand(redisClient *c); void typeCommand(client *c);
void lsetCommand(redisClient *c); void lsetCommand(client *c);
void saddCommand(redisClient *c); void saddCommand(client *c);
void sremCommand(redisClient *c); void sremCommand(client *c);
void smoveCommand(redisClient *c); void smoveCommand(client *c);
void sismemberCommand(redisClient *c); void sismemberCommand(client *c);
void scardCommand(redisClient *c); void scardCommand(client *c);
void spopCommand(redisClient *c); void spopCommand(client *c);
void srandmemberCommand(redisClient *c); void srandmemberCommand(client *c);
void sinterCommand(redisClient *c); void sinterCommand(client *c);
void sinterstoreCommand(redisClient *c); void sinterstoreCommand(client *c);
void sunionCommand(redisClient *c); void sunionCommand(client *c);
void sunionstoreCommand(redisClient *c); void sunionstoreCommand(client *c);
void sdiffCommand(redisClient *c); void sdiffCommand(client *c);
void sdiffstoreCommand(redisClient *c); void sdiffstoreCommand(client *c);
void sscanCommand(redisClient *c); void sscanCommand(client *c);
void syncCommand(redisClient *c); void syncCommand(client *c);
void flushdbCommand(redisClient *c); void flushdbCommand(client *c);
void flushallCommand(redisClient *c); void flushallCommand(client *c);
void sortCommand(redisClient *c); void sortCommand(client *c);
void lremCommand(redisClient *c); void lremCommand(client *c);
void rpoplpushCommand(redisClient *c); void rpoplpushCommand(client *c);
void infoCommand(redisClient *c); void infoCommand(client *c);
void mgetCommand(redisClient *c); void mgetCommand(client *c);
void monitorCommand(redisClient *c); void monitorCommand(client *c);
void expireCommand(redisClient *c); void expireCommand(client *c);
void expireatCommand(redisClient *c); void expireatCommand(client *c);
void pexpireCommand(redisClient *c); void pexpireCommand(client *c);
void pexpireatCommand(redisClient *c); void pexpireatCommand(client *c);
void getsetCommand(redisClient *c); void getsetCommand(client *c);
void ttlCommand(redisClient *c); void ttlCommand(client *c);
void pttlCommand(redisClient *c); void pttlCommand(client *c);
void persistCommand(redisClient *c); void persistCommand(client *c);
void slaveofCommand(redisClient *c); void slaveofCommand(client *c);
void roleCommand(redisClient *c); void roleCommand(client *c);
void debugCommand(redisClient *c); void debugCommand(client *c);
void msetCommand(redisClient *c); void msetCommand(client *c);
void msetnxCommand(redisClient *c); void msetnxCommand(client *c);
void zaddCommand(redisClient *c); void zaddCommand(client *c);
void zincrbyCommand(redisClient *c); void zincrbyCommand(client *c);
void zrangeCommand(redisClient *c); void zrangeCommand(client *c);
void zrangebyscoreCommand(redisClient *c); void zrangebyscoreCommand(client *c);
void zrevrangebyscoreCommand(redisClient *c); void zrevrangebyscoreCommand(client *c);
void zrangebylexCommand(redisClient *c); void zrangebylexCommand(client *c);
void zrevrangebylexCommand(redisClient *c); void zrevrangebylexCommand(client *c);
void zcountCommand(redisClient *c); void zcountCommand(client *c);
void zlexcountCommand(redisClient *c); void zlexcountCommand(client *c);
void zrevrangeCommand(redisClient *c); void zrevrangeCommand(client *c);
void zcardCommand(redisClient *c); void zcardCommand(client *c);
void zremCommand(redisClient *c); void zremCommand(client *c);
void zscoreCommand(redisClient *c); void zscoreCommand(client *c);
void zremrangebyscoreCommand(redisClient *c); void zremrangebyscoreCommand(client *c);
void zremrangebylexCommand(redisClient *c); void zremrangebylexCommand(client *c);
void multiCommand(redisClient *c); void multiCommand(client *c);
void execCommand(redisClient *c); void execCommand(client *c);
void discardCommand(redisClient *c); void discardCommand(client *c);
void blpopCommand(redisClient *c); void blpopCommand(client *c);
void brpopCommand(redisClient *c); void brpopCommand(client *c);
void brpoplpushCommand(redisClient *c); void brpoplpushCommand(client *c);
void appendCommand(redisClient *c); void appendCommand(client *c);
void strlenCommand(redisClient *c); void strlenCommand(client *c);
void zrankCommand(redisClient *c); void zrankCommand(client *c);
void zrevrankCommand(redisClient *c); void zrevrankCommand(client *c);
void hsetCommand(redisClient *c); void hsetCommand(client *c);
void hsetnxCommand(redisClient *c); void hsetnxCommand(client *c);
void hgetCommand(redisClient *c); void hgetCommand(client *c);
void hmsetCommand(redisClient *c); void hmsetCommand(client *c);
void hmgetCommand(redisClient *c); void hmgetCommand(client *c);
void hdelCommand(redisClient *c); void hdelCommand(client *c);
void hlenCommand(redisClient *c); void hlenCommand(client *c);
void hstrlenCommand(redisClient *c); void hstrlenCommand(client *c);
void zremrangebyrankCommand(redisClient *c); void zremrangebyrankCommand(client *c);
void zunionstoreCommand(redisClient *c); void zunionstoreCommand(client *c);
void zinterstoreCommand(redisClient *c); void zinterstoreCommand(client *c);
void zscanCommand(redisClient *c); void zscanCommand(client *c);
void hkeysCommand(redisClient *c); void hkeysCommand(client *c);
void hvalsCommand(redisClient *c); void hvalsCommand(client *c);
void hgetallCommand(redisClient *c); void hgetallCommand(client *c);
void hexistsCommand(redisClient *c); void hexistsCommand(client *c);
void hscanCommand(redisClient *c); void hscanCommand(client *c);
void configCommand(redisClient *c); void configCommand(client *c);
void hincrbyCommand(redisClient *c); void hincrbyCommand(client *c);
void hincrbyfloatCommand(redisClient *c); void hincrbyfloatCommand(client *c);
void subscribeCommand(redisClient *c); void subscribeCommand(client *c);
void unsubscribeCommand(redisClient *c); void unsubscribeCommand(client *c);
void psubscribeCommand(redisClient *c); void psubscribeCommand(client *c);
void punsubscribeCommand(redisClient *c); void punsubscribeCommand(client *c);
void publishCommand(redisClient *c); void publishCommand(client *c);
void pubsubCommand(redisClient *c); void pubsubCommand(client *c);
void watchCommand(redisClient *c); void watchCommand(client *c);
void unwatchCommand(redisClient *c); void unwatchCommand(client *c);
void clusterCommand(redisClient *c); void clusterCommand(client *c);
void restoreCommand(redisClient *c); void restoreCommand(client *c);
void migrateCommand(redisClient *c); void migrateCommand(client *c);
void askingCommand(redisClient *c); void askingCommand(client *c);
void readonlyCommand(redisClient *c); void readonlyCommand(client *c);
void readwriteCommand(redisClient *c); void readwriteCommand(client *c);
void dumpCommand(redisClient *c); void dumpCommand(client *c);
void objectCommand(redisClient *c); void objectCommand(client *c);
void clientCommand(redisClient *c); void clientCommand(client *c);
void evalCommand(redisClient *c); void evalCommand(client *c);
void evalShaCommand(redisClient *c); void evalShaCommand(client *c);
void scriptCommand(redisClient *c); void scriptCommand(client *c);
void timeCommand(redisClient *c); void timeCommand(client *c);
void bitopCommand(redisClient *c); void bitopCommand(client *c);
void bitcountCommand(redisClient *c); void bitcountCommand(client *c);
void bitposCommand(redisClient *c); void bitposCommand(client *c);
void replconfCommand(redisClient *c); void replconfCommand(client *c);
void waitCommand(redisClient *c); void waitCommand(client *c);
void geoencodeCommand(redisClient *c); void geoencodeCommand(client *c);
void geodecodeCommand(redisClient *c); void geodecodeCommand(client *c);
void georadiusByMemberCommand(redisClient *c); void georadiusByMemberCommand(client *c);
void georadiusCommand(redisClient *c); void georadiusCommand(client *c);
void geoaddCommand(redisClient *c); void geoaddCommand(client *c);
void geohashCommand(redisClient *c); void geohashCommand(client *c);
void geoposCommand(redisClient *c); void geoposCommand(client *c);
void geodistCommand(redisClient *c); void geodistCommand(client *c);
void pfselftestCommand(redisClient *c); void pfselftestCommand(client *c);
void pfaddCommand(redisClient *c); void pfaddCommand(client *c);
void pfcountCommand(redisClient *c); void pfcountCommand(client *c);
void pfmergeCommand(redisClient *c); void pfmergeCommand(client *c);
void pfdebugCommand(redisClient *c); void pfdebugCommand(client *c);
void latencyCommand(redisClient *c); void latencyCommand(client *c);
#if defined(__GNUC__) #if defined(__GNUC__)
void *calloc(size_t count, size_t size) __attribute__ ((deprecated)); void *calloc(size_t count, size_t size) __attribute__ ((deprecated));
...@@ -1581,7 +1581,7 @@ void *realloc(void *ptr, size_t size) __attribute__ ((deprecated)); ...@@ -1581,7 +1581,7 @@ void *realloc(void *ptr, size_t size) __attribute__ ((deprecated));
#endif #endif
/* Debugging stuff */ /* 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 _redisAssert(char *estr, char *file, int line);
void _redisPanic(char *msg, char *file, int line); void _redisPanic(char *msg, char *file, int line);
void bugReportStart(void); void bugReportStart(void);
......
...@@ -127,7 +127,7 @@ void slowlogReset(void) { ...@@ -127,7 +127,7 @@ void slowlogReset(void) {
/* The SLOWLOG command. Implements all the subcommands needed to handle the /* The SLOWLOG command. Implements all the subcommands needed to handle the
* Redis slow log. */ * Redis slow log. */
void slowlogCommand(redisClient *c) { void slowlogCommand(client *c) {
if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"reset")) { if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"reset")) {
slowlogReset(); slowlogReset();
addReply(c,shared.ok); addReply(c,shared.ok);
......
...@@ -44,4 +44,4 @@ void slowlogInit(void); ...@@ -44,4 +44,4 @@ void slowlogInit(void);
void slowlogPushEntryIfNeeded(robj **argv, int argc, long long duration); void slowlogPushEntryIfNeeded(robj **argv, int argc, long long duration);
/* Exported commands */ /* Exported commands */
void slowlogCommand(redisClient *c); void slowlogCommand(client *c);
...@@ -186,7 +186,7 @@ int sortCompare(const void *s1, const void *s2) { ...@@ -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 /* The SORT command is the most complex command in Redis. Warning: this code
* is optimized for speed and a bit less for readability */ * is optimized for speed and a bit less for readability */
void sortCommand(redisClient *c) { void sortCommand(client *c) {
list *operations; list *operations;
unsigned int outputlen = 0; unsigned int outputlen = 0;
int desc = 0, alpha = 0; int desc = 0, alpha = 0;
......
...@@ -415,7 +415,7 @@ robj *hashTypeCurrentObject(hashTypeIterator *hi, int what) { ...@@ -415,7 +415,7 @@ robj *hashTypeCurrentObject(hashTypeIterator *hi, int what) {
return dst; return dst;
} }
robj *hashTypeLookupWriteOrCreate(redisClient *c, robj *key) { robj *hashTypeLookupWriteOrCreate(client *c, robj *key) {
robj *o = lookupKeyWrite(c->db,key); robj *o = lookupKeyWrite(c->db,key);
if (o == NULL) { if (o == NULL) {
o = createHashObject(); o = createHashObject();
...@@ -483,7 +483,7 @@ void hashTypeConvert(robj *o, int enc) { ...@@ -483,7 +483,7 @@ void hashTypeConvert(robj *o, int enc) {
* Hash type commands * Hash type commands
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void hsetCommand(redisClient *c) { void hsetCommand(client *c) {
int update; int update;
robj *o; robj *o;
...@@ -497,7 +497,7 @@ void hsetCommand(redisClient *c) { ...@@ -497,7 +497,7 @@ void hsetCommand(redisClient *c) {
server.dirty++; server.dirty++;
} }
void hsetnxCommand(redisClient *c) { void hsetnxCommand(client *c) {
robj *o; robj *o;
if ((o = hashTypeLookupWriteOrCreate(c,c->argv[1])) == NULL) return; if ((o = hashTypeLookupWriteOrCreate(c,c->argv[1])) == NULL) return;
hashTypeTryConversion(o,c->argv,2,3); hashTypeTryConversion(o,c->argv,2,3);
...@@ -514,7 +514,7 @@ void hsetnxCommand(redisClient *c) { ...@@ -514,7 +514,7 @@ void hsetnxCommand(redisClient *c) {
} }
} }
void hmsetCommand(redisClient *c) { void hmsetCommand(client *c) {
int i; int i;
robj *o; robj *o;
...@@ -535,7 +535,7 @@ void hmsetCommand(redisClient *c) { ...@@ -535,7 +535,7 @@ void hmsetCommand(redisClient *c) {
server.dirty++; server.dirty++;
} }
void hincrbyCommand(redisClient *c) { void hincrbyCommand(client *c) {
long long value, incr, oldvalue; long long value, incr, oldvalue;
robj *o, *current, *new; robj *o, *current, *new;
...@@ -569,7 +569,7 @@ void hincrbyCommand(redisClient *c) { ...@@ -569,7 +569,7 @@ void hincrbyCommand(redisClient *c) {
server.dirty++; server.dirty++;
} }
void hincrbyfloatCommand(redisClient *c) { void hincrbyfloatCommand(client *c) {
double long value, incr; double long value, incr;
robj *o, *current, *new, *aux; robj *o, *current, *new, *aux;
...@@ -605,7 +605,7 @@ void hincrbyfloatCommand(redisClient *c) { ...@@ -605,7 +605,7 @@ void hincrbyfloatCommand(redisClient *c) {
decrRefCount(new); decrRefCount(new);
} }
static void addHashFieldToReply(redisClient *c, robj *o, robj *field) { static void addHashFieldToReply(client *c, robj *o, robj *field) {
int ret; int ret;
if (o == NULL) { if (o == NULL) {
...@@ -644,7 +644,7 @@ static void addHashFieldToReply(redisClient *c, robj *o, robj *field) { ...@@ -644,7 +644,7 @@ static void addHashFieldToReply(redisClient *c, robj *o, robj *field) {
} }
} }
void hgetCommand(redisClient *c) { void hgetCommand(client *c) {
robj *o; robj *o;
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk)) == NULL || if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk)) == NULL ||
...@@ -653,7 +653,7 @@ void hgetCommand(redisClient *c) { ...@@ -653,7 +653,7 @@ void hgetCommand(redisClient *c) {
addHashFieldToReply(c, o, c->argv[2]); addHashFieldToReply(c, o, c->argv[2]);
} }
void hmgetCommand(redisClient *c) { void hmgetCommand(client *c) {
robj *o; robj *o;
int i; int i;
...@@ -671,7 +671,7 @@ void hmgetCommand(redisClient *c) { ...@@ -671,7 +671,7 @@ void hmgetCommand(redisClient *c) {
} }
} }
void hdelCommand(redisClient *c) { void hdelCommand(client *c) {
robj *o; robj *o;
int j, deleted = 0, keyremoved = 0; int j, deleted = 0, keyremoved = 0;
...@@ -699,7 +699,7 @@ void hdelCommand(redisClient *c) { ...@@ -699,7 +699,7 @@ void hdelCommand(redisClient *c) {
addReplyLongLong(c,deleted); addReplyLongLong(c,deleted);
} }
void hlenCommand(redisClient *c) { void hlenCommand(client *c) {
robj *o; robj *o;
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL || if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
...@@ -708,7 +708,7 @@ void hlenCommand(redisClient *c) { ...@@ -708,7 +708,7 @@ void hlenCommand(redisClient *c) {
addReplyLongLong(c,hashTypeLength(o)); addReplyLongLong(c,hashTypeLength(o));
} }
void hstrlenCommand(redisClient *c) { void hstrlenCommand(client *c) {
robj *o; robj *o;
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL || if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
...@@ -716,7 +716,7 @@ void hstrlenCommand(redisClient *c) { ...@@ -716,7 +716,7 @@ void hstrlenCommand(redisClient *c) {
addReplyLongLong(c,hashTypeGetValueLength(o,c->argv[2])); 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) { if (hi->encoding == REDIS_ENCODING_ZIPLIST) {
unsigned char *vstr = NULL; unsigned char *vstr = NULL;
unsigned int vlen = UINT_MAX; unsigned int vlen = UINT_MAX;
...@@ -740,7 +740,7 @@ static void addHashIteratorCursorToReply(redisClient *c, hashTypeIterator *hi, i ...@@ -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; robj *o;
hashTypeIterator *hi; hashTypeIterator *hi;
int multiplier = 0; int multiplier = 0;
...@@ -771,19 +771,19 @@ void genericHgetallCommand(redisClient *c, int flags) { ...@@ -771,19 +771,19 @@ void genericHgetallCommand(redisClient *c, int flags) {
redisAssert(count == length); redisAssert(count == length);
} }
void hkeysCommand(redisClient *c) { void hkeysCommand(client *c) {
genericHgetallCommand(c,REDIS_HASH_KEY); genericHgetallCommand(c,REDIS_HASH_KEY);
} }
void hvalsCommand(redisClient *c) { void hvalsCommand(client *c) {
genericHgetallCommand(c,REDIS_HASH_VALUE); genericHgetallCommand(c,REDIS_HASH_VALUE);
} }
void hgetallCommand(redisClient *c) { void hgetallCommand(client *c) {
genericHgetallCommand(c,REDIS_HASH_KEY|REDIS_HASH_VALUE); genericHgetallCommand(c,REDIS_HASH_KEY|REDIS_HASH_VALUE);
} }
void hexistsCommand(redisClient *c) { void hexistsCommand(client *c) {
robj *o; robj *o;
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL || if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
checkType(c,o,REDIS_HASH)) return; checkType(c,o,REDIS_HASH)) return;
...@@ -791,7 +791,7 @@ void hexistsCommand(redisClient *c) { ...@@ -791,7 +791,7 @@ void hexistsCommand(redisClient *c) {
addReply(c, hashTypeExists(o,c->argv[2]) ? shared.cone : shared.czero); addReply(c, hashTypeExists(o,c->argv[2]) ? shared.cone : shared.czero);
} }
void hscanCommand(redisClient *c) { void hscanCommand(client *c) {
robj *o; robj *o;
unsigned long cursor; unsigned long cursor;
......
...@@ -194,7 +194,7 @@ void listTypeConvert(robj *subject, int enc) { ...@@ -194,7 +194,7 @@ void listTypeConvert(robj *subject, int enc) {
* List Commands * List Commands
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void pushGenericCommand(redisClient *c, int where) { void pushGenericCommand(client *c, int where) {
int j, waiting = 0, pushed = 0; int j, waiting = 0, pushed = 0;
robj *lobj = lookupKeyWrite(c->db,c->argv[1]); robj *lobj = lookupKeyWrite(c->db,c->argv[1]);
...@@ -224,15 +224,15 @@ void pushGenericCommand(redisClient *c, int where) { ...@@ -224,15 +224,15 @@ void pushGenericCommand(redisClient *c, int where) {
server.dirty += pushed; server.dirty += pushed;
} }
void lpushCommand(redisClient *c) { void lpushCommand(client *c) {
pushGenericCommand(c,REDIS_HEAD); pushGenericCommand(c,REDIS_HEAD);
} }
void rpushCommand(redisClient *c) { void rpushCommand(client *c) {
pushGenericCommand(c,REDIS_TAIL); 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; robj *subject;
listTypeIterator *iter; listTypeIterator *iter;
listTypeEntry entry; listTypeEntry entry;
...@@ -275,17 +275,17 @@ void pushxGenericCommand(redisClient *c, robj *refval, robj *val, int where) { ...@@ -275,17 +275,17 @@ void pushxGenericCommand(redisClient *c, robj *refval, robj *val, int where) {
addReplyLongLong(c,listTypeLength(subject)); addReplyLongLong(c,listTypeLength(subject));
} }
void lpushxCommand(redisClient *c) { void lpushxCommand(client *c) {
c->argv[2] = tryObjectEncoding(c->argv[2]); c->argv[2] = tryObjectEncoding(c->argv[2]);
pushxGenericCommand(c,NULL,c->argv[2],REDIS_HEAD); pushxGenericCommand(c,NULL,c->argv[2],REDIS_HEAD);
} }
void rpushxCommand(redisClient *c) { void rpushxCommand(client *c) {
c->argv[2] = tryObjectEncoding(c->argv[2]); c->argv[2] = tryObjectEncoding(c->argv[2]);
pushxGenericCommand(c,NULL,c->argv[2],REDIS_TAIL); pushxGenericCommand(c,NULL,c->argv[2],REDIS_TAIL);
} }
void linsertCommand(redisClient *c) { void linsertCommand(client *c) {
c->argv[4] = tryObjectEncoding(c->argv[4]); c->argv[4] = tryObjectEncoding(c->argv[4]);
if (strcasecmp(c->argv[2]->ptr,"after") == 0) { if (strcasecmp(c->argv[2]->ptr,"after") == 0) {
pushxGenericCommand(c,c->argv[3],c->argv[4],REDIS_TAIL); pushxGenericCommand(c,c->argv[3],c->argv[4],REDIS_TAIL);
...@@ -296,13 +296,13 @@ void linsertCommand(redisClient *c) { ...@@ -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); robj *o = lookupKeyReadOrReply(c,c->argv[1],shared.czero);
if (o == NULL || checkType(c,o,REDIS_LIST)) return; if (o == NULL || checkType(c,o,REDIS_LIST)) return;
addReplyLongLong(c,listTypeLength(o)); addReplyLongLong(c,listTypeLength(o));
} }
void lindexCommand(redisClient *c) { void lindexCommand(client *c) {
robj *o = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk); robj *o = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk);
if (o == NULL || checkType(c,o,REDIS_LIST)) return; if (o == NULL || checkType(c,o,REDIS_LIST)) return;
long index; long index;
...@@ -329,7 +329,7 @@ void lindexCommand(redisClient *c) { ...@@ -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); robj *o = lookupKeyWriteOrReply(c,c->argv[1],shared.nokeyerr);
if (o == NULL || checkType(c,o,REDIS_LIST)) return; if (o == NULL || checkType(c,o,REDIS_LIST)) return;
long index; long index;
...@@ -355,7 +355,7 @@ void lsetCommand(redisClient *c) { ...@@ -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); robj *o = lookupKeyWriteOrReply(c,c->argv[1],shared.nullbulk);
if (o == NULL || checkType(c,o,REDIS_LIST)) return; if (o == NULL || checkType(c,o,REDIS_LIST)) return;
...@@ -378,15 +378,15 @@ void popGenericCommand(redisClient *c, int where) { ...@@ -378,15 +378,15 @@ void popGenericCommand(redisClient *c, int where) {
} }
} }
void lpopCommand(redisClient *c) { void lpopCommand(client *c) {
popGenericCommand(c,REDIS_HEAD); popGenericCommand(c,REDIS_HEAD);
} }
void rpopCommand(redisClient *c) { void rpopCommand(client *c) {
popGenericCommand(c,REDIS_TAIL); popGenericCommand(c,REDIS_TAIL);
} }
void lrangeCommand(redisClient *c) { void lrangeCommand(client *c) {
robj *o; robj *o;
long start, end, llen, rangelen; long start, end, llen, rangelen;
...@@ -432,7 +432,7 @@ void lrangeCommand(redisClient *c) { ...@@ -432,7 +432,7 @@ void lrangeCommand(redisClient *c) {
} }
} }
void ltrimCommand(redisClient *c) { void ltrimCommand(client *c) {
robj *o; robj *o;
long start, end, llen, ltrim, rtrim; long start, end, llen, ltrim, rtrim;
...@@ -478,7 +478,7 @@ void ltrimCommand(redisClient *c) { ...@@ -478,7 +478,7 @@ void ltrimCommand(redisClient *c) {
addReply(c,shared.ok); addReply(c,shared.ok);
} }
void lremCommand(redisClient *c) { void lremCommand(client *c) {
robj *subject, *obj; robj *subject, *obj;
obj = c->argv[3]; obj = c->argv[3];
long toremove; long toremove;
...@@ -533,7 +533,7 @@ void lremCommand(redisClient *c) { ...@@ -533,7 +533,7 @@ void lremCommand(redisClient *c) {
* as well. This command was originally proposed by Ezra Zygmuntowicz. * 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 */ /* Create the list if the key does not exist */
if (!dstobj) { if (!dstobj) {
dstobj = createQuicklistObject(); dstobj = createQuicklistObject();
...@@ -548,7 +548,7 @@ void rpoplpushHandlePush(redisClient *c, robj *dstkey, robj *dstobj, robj *value ...@@ -548,7 +548,7 @@ void rpoplpushHandlePush(redisClient *c, robj *dstkey, robj *dstobj, robj *value
addReplyBulk(c,value); addReplyBulk(c,value);
} }
void rpoplpushCommand(redisClient *c) { void rpoplpushCommand(client *c) {
robj *sobj, *value; robj *sobj, *value;
if ((sobj = lookupKeyWriteOrReply(c,c->argv[1],shared.nullbulk)) == NULL || if ((sobj = lookupKeyWriteOrReply(c,c->argv[1],shared.nullbulk)) == NULL ||
checkType(c,sobj,REDIS_LIST)) return; checkType(c,sobj,REDIS_LIST)) return;
...@@ -608,7 +608,7 @@ void rpoplpushCommand(redisClient *c) { ...@@ -608,7 +608,7 @@ void rpoplpushCommand(redisClient *c) {
/* Set a client in blocking mode for the specified key, with the specified /* Set a client in blocking mode for the specified key, with the specified
* timeout */ * 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; dictEntry *de;
list *l; list *l;
int j; int j;
...@@ -643,7 +643,7 @@ void blockForKeys(redisClient *c, robj **keys, int numkeys, mstime_t timeout, ro ...@@ -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. /* Unblock a client that's waiting in a blocking operation such as BLPOP.
* You should never call this function directly, but unblockClient() instead. */ * You should never call this function directly, but unblockClient() instead. */
void unblockClientWaitingData(redisClient *c) { void unblockClientWaitingData(client *c) {
dictEntry *de; dictEntry *de;
dictIterator *di; dictIterator *di;
list *l; list *l;
...@@ -721,7 +721,7 @@ void signalListAsReady(redisDb *db, robj *key) { ...@@ -721,7 +721,7 @@ void signalListAsReady(redisDb *db, robj *key) {
* should be undone as the client was not served: This only happens for * 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 * BRPOPLPUSH that fails to push the value to the destination key as it is
* of the wrong type. */ * 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]; robj *argv[3];
...@@ -815,7 +815,7 @@ void handleClientsBlockedOnLists(void) { ...@@ -815,7 +815,7 @@ void handleClientsBlockedOnLists(void) {
while(numclients--) { while(numclients--) {
listNode *clientnode = listFirst(clients); listNode *clientnode = listFirst(clients);
redisClient *receiver = clientnode->value; client *receiver = clientnode->value;
robj *dstkey = receiver->bpop.target; robj *dstkey = receiver->bpop.target;
int where = (receiver->lastcmd && int where = (receiver->lastcmd &&
receiver->lastcmd->proc == blpopCommand) ? receiver->lastcmd->proc == blpopCommand) ?
...@@ -863,7 +863,7 @@ void handleClientsBlockedOnLists(void) { ...@@ -863,7 +863,7 @@ void handleClientsBlockedOnLists(void) {
} }
/* Blocking RPOP/LPOP */ /* Blocking RPOP/LPOP */
void blockingPopGenericCommand(redisClient *c, int where) { void blockingPopGenericCommand(client *c, int where) {
robj *o; robj *o;
mstime_t timeout; mstime_t timeout;
int j; int j;
...@@ -919,15 +919,15 @@ void blockingPopGenericCommand(redisClient *c, int where) { ...@@ -919,15 +919,15 @@ void blockingPopGenericCommand(redisClient *c, int where) {
blockForKeys(c, c->argv + 1, c->argc - 2, timeout, NULL); blockForKeys(c, c->argv + 1, c->argc - 2, timeout, NULL);
} }
void blpopCommand(redisClient *c) { void blpopCommand(client *c) {
blockingPopGenericCommand(c,REDIS_HEAD); blockingPopGenericCommand(c,REDIS_HEAD);
} }
void brpopCommand(redisClient *c) { void brpopCommand(client *c) {
blockingPopGenericCommand(c,REDIS_TAIL); blockingPopGenericCommand(c,REDIS_TAIL);
} }
void brpoplpushCommand(redisClient *c) { void brpoplpushCommand(client *c) {
mstime_t timeout; mstime_t timeout;
if (getTimeoutFromObjectOrReply(c,c->argv[3],&timeout,UNIT_SECONDS) if (getTimeoutFromObjectOrReply(c,c->argv[3],&timeout,UNIT_SECONDS)
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
* Set Commands * Set Commands
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void sunionDiffGenericCommand(redisClient *c, robj **setkeys, int setnum, void sunionDiffGenericCommand(client *c, robj **setkeys, int setnum,
robj *dstkey, int op); robj *dstkey, int op);
/* Factory method to return a set that *can* hold "value". When the object has /* Factory method to return a set that *can* hold "value". When the object has
...@@ -269,7 +269,7 @@ void setTypeConvert(robj *setobj, int enc) { ...@@ -269,7 +269,7 @@ void setTypeConvert(robj *setobj, int enc) {
} }
} }
void saddCommand(redisClient *c) { void saddCommand(client *c) {
robj *set; robj *set;
int j, added = 0; int j, added = 0;
...@@ -296,7 +296,7 @@ void saddCommand(redisClient *c) { ...@@ -296,7 +296,7 @@ void saddCommand(redisClient *c) {
addReplyLongLong(c,added); addReplyLongLong(c,added);
} }
void sremCommand(redisClient *c) { void sremCommand(client *c) {
robj *set; robj *set;
int j, deleted = 0, keyremoved = 0; int j, deleted = 0, keyremoved = 0;
...@@ -324,7 +324,7 @@ void sremCommand(redisClient *c) { ...@@ -324,7 +324,7 @@ void sremCommand(redisClient *c) {
addReplyLongLong(c,deleted); addReplyLongLong(c,deleted);
} }
void smoveCommand(redisClient *c) { void smoveCommand(client *c) {
robj *srcset, *dstset, *ele; robj *srcset, *dstset, *ele;
srcset = lookupKeyWrite(c->db,c->argv[1]); srcset = lookupKeyWrite(c->db,c->argv[1]);
dstset = lookupKeyWrite(c->db,c->argv[2]); dstset = lookupKeyWrite(c->db,c->argv[2]);
...@@ -377,7 +377,7 @@ void smoveCommand(redisClient *c) { ...@@ -377,7 +377,7 @@ void smoveCommand(redisClient *c) {
addReply(c,shared.cone); addReply(c,shared.cone);
} }
void sismemberCommand(redisClient *c) { void sismemberCommand(client *c) {
robj *set; robj *set;
if ((set = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL || if ((set = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
...@@ -390,7 +390,7 @@ void sismemberCommand(redisClient *c) { ...@@ -390,7 +390,7 @@ void sismemberCommand(redisClient *c) {
addReply(c,shared.czero); addReply(c,shared.czero);
} }
void scardCommand(redisClient *c) { void scardCommand(client *c) {
robj *o; robj *o;
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL || if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
...@@ -407,7 +407,7 @@ void scardCommand(redisClient *c) { ...@@ -407,7 +407,7 @@ void scardCommand(redisClient *c) {
* implementation for more info. */ * implementation for more info. */
#define SPOP_MOVE_STRATEGY_MUL 5 #define SPOP_MOVE_STRATEGY_MUL 5
void spopWithCountCommand(redisClient *c) { void spopWithCountCommand(client *c) {
long l; long l;
unsigned long count, size; unsigned long count, size;
robj *set; robj *set;
...@@ -556,7 +556,7 @@ void spopWithCountCommand(redisClient *c) { ...@@ -556,7 +556,7 @@ void spopWithCountCommand(redisClient *c) {
preventCommandPropagation(c); preventCommandPropagation(c);
} }
void spopCommand(redisClient *c) { void spopCommand(client *c) {
robj *set, *ele, *aux; robj *set, *ele, *aux;
int64_t llele; int64_t llele;
int encoding; int encoding;
...@@ -616,7 +616,7 @@ void spopCommand(redisClient *c) { ...@@ -616,7 +616,7 @@ void spopCommand(redisClient *c) {
* implementation for more info. */ * implementation for more info. */
#define SRANDMEMBER_SUB_STRATEGY_MUL 3 #define SRANDMEMBER_SUB_STRATEGY_MUL 3
void srandmemberWithCountCommand(redisClient *c) { void srandmemberWithCountCommand(client *c) {
long l; long l;
unsigned long count, size; unsigned long count, size;
int uniq = 1; int uniq = 1;
...@@ -749,7 +749,7 @@ void srandmemberWithCountCommand(redisClient *c) { ...@@ -749,7 +749,7 @@ void srandmemberWithCountCommand(redisClient *c) {
} }
} }
void srandmemberCommand(redisClient *c) { void srandmemberCommand(client *c) {
robj *set, *ele; robj *set, *ele;
int64_t llele; int64_t llele;
int encoding; int encoding;
...@@ -785,7 +785,7 @@ int qsortCompareSetsByRevCardinality(const void *s1, const void *s2) { ...@@ -785,7 +785,7 @@ int qsortCompareSetsByRevCardinality(const void *s1, const void *s2) {
return (o2 ? setTypeSize(o2) : 0) - (o1 ? setTypeSize(o1) : 0); 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) { unsigned long setnum, robj *dstkey) {
robj **sets = zmalloc(sizeof(robj*)*setnum); robj **sets = zmalloc(sizeof(robj*)*setnum);
setTypeIterator *si; setTypeIterator *si;
...@@ -921,11 +921,11 @@ void sinterGenericCommand(redisClient *c, robj **setkeys, ...@@ -921,11 +921,11 @@ void sinterGenericCommand(redisClient *c, robj **setkeys,
zfree(sets); zfree(sets);
} }
void sinterCommand(redisClient *c) { void sinterCommand(client *c) {
sinterGenericCommand(c,c->argv+1,c->argc-1,NULL); 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]); sinterGenericCommand(c,c->argv+2,c->argc-2,c->argv[1]);
} }
...@@ -933,7 +933,7 @@ void sinterstoreCommand(redisClient *c) { ...@@ -933,7 +933,7 @@ void sinterstoreCommand(redisClient *c) {
#define REDIS_OP_DIFF 1 #define REDIS_OP_DIFF 1
#define REDIS_OP_INTER 2 #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 *dstkey, int op) {
robj **sets = zmalloc(sizeof(robj*)*setnum); robj **sets = zmalloc(sizeof(robj*)*setnum);
setTypeIterator *si; setTypeIterator *si;
...@@ -1092,23 +1092,23 @@ void sunionDiffGenericCommand(redisClient *c, robj **setkeys, int setnum, ...@@ -1092,23 +1092,23 @@ void sunionDiffGenericCommand(redisClient *c, robj **setkeys, int setnum,
zfree(sets); zfree(sets);
} }
void sunionCommand(redisClient *c) { void sunionCommand(client *c) {
sunionDiffGenericCommand(c,c->argv+1,c->argc-1,NULL,REDIS_OP_UNION); 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); 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); 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); sunionDiffGenericCommand(c,c->argv+2,c->argc-2,c->argv[1],REDIS_OP_DIFF);
} }
void sscanCommand(redisClient *c) { void sscanCommand(client *c) {
robj *set; robj *set;
unsigned long cursor; unsigned long cursor;
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
* String Commands * String Commands
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
static int checkStringLength(redisClient *c, long long size) { static int checkStringLength(client *c, long long size) {
if (size > 512*1024*1024) { if (size > 512*1024*1024) {
addReplyError(c,"string exceeds maximum allowed size (512MB)"); addReplyError(c,"string exceeds maximum allowed size (512MB)");
return REDIS_ERR; return REDIS_ERR;
...@@ -64,7 +64,7 @@ static int checkStringLength(redisClient *c, long long size) { ...@@ -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_EX (1<<2) /* Set if time in seconds is given */
#define REDIS_SET_PX (1<<3) /* Set if time in ms in 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 */ long long milliseconds = 0; /* initialized to avoid any harmness warning */
if (expire) { if (expire) {
...@@ -93,7 +93,7 @@ void setGenericCommand(redisClient *c, int flags, robj *key, robj *val, robj *ex ...@@ -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>] */ /* SET key value [NX] [XX] [EX <seconds>] [PX <milliseconds>] */
void setCommand(redisClient *c) { void setCommand(client *c) {
int j; int j;
robj *expire = NULL; robj *expire = NULL;
int unit = UNIT_SECONDS; int unit = UNIT_SECONDS;
...@@ -139,22 +139,22 @@ void setCommand(redisClient *c) { ...@@ -139,22 +139,22 @@ void setCommand(redisClient *c) {
setGenericCommand(c,flags,c->argv[1],c->argv[2],expire,unit,NULL,NULL); 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]); c->argv[2] = tryObjectEncoding(c->argv[2]);
setGenericCommand(c,REDIS_SET_NX,c->argv[1],c->argv[2],NULL,0,shared.cone,shared.czero); 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]); 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); 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]); 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); 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; robj *o;
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk)) == NULL) if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk)) == NULL)
...@@ -169,11 +169,11 @@ int getGenericCommand(redisClient *c) { ...@@ -169,11 +169,11 @@ int getGenericCommand(redisClient *c) {
} }
} }
void getCommand(redisClient *c) { void getCommand(client *c) {
getGenericCommand(c); getGenericCommand(c);
} }
void getsetCommand(redisClient *c) { void getsetCommand(client *c) {
if (getGenericCommand(c) == REDIS_ERR) return; if (getGenericCommand(c) == REDIS_ERR) return;
c->argv[2] = tryObjectEncoding(c->argv[2]); c->argv[2] = tryObjectEncoding(c->argv[2]);
setKey(c->db,c->argv[1],c->argv[2]); setKey(c->db,c->argv[1],c->argv[2]);
...@@ -181,7 +181,7 @@ void getsetCommand(redisClient *c) { ...@@ -181,7 +181,7 @@ void getsetCommand(redisClient *c) {
server.dirty++; server.dirty++;
} }
void setrangeCommand(redisClient *c) { void setrangeCommand(client *c) {
robj *o; robj *o;
long offset; long offset;
sds value = c->argv[3]->ptr; sds value = c->argv[3]->ptr;
...@@ -241,7 +241,7 @@ void setrangeCommand(redisClient *c) { ...@@ -241,7 +241,7 @@ void setrangeCommand(redisClient *c) {
addReplyLongLong(c,sdslen(o->ptr)); addReplyLongLong(c,sdslen(o->ptr));
} }
void getrangeCommand(redisClient *c) { void getrangeCommand(client *c) {
robj *o; robj *o;
long long start, end; long long start, end;
char *str, llbuf[32]; char *str, llbuf[32];
...@@ -278,7 +278,7 @@ void getrangeCommand(redisClient *c) { ...@@ -278,7 +278,7 @@ void getrangeCommand(redisClient *c) {
} }
} }
void mgetCommand(redisClient *c) { void mgetCommand(client *c) {
int j; int j;
addReplyMultiBulkLen(c,c->argc-1); addReplyMultiBulkLen(c,c->argc-1);
...@@ -296,7 +296,7 @@ void mgetCommand(redisClient *c) { ...@@ -296,7 +296,7 @@ void mgetCommand(redisClient *c) {
} }
} }
void msetGenericCommand(redisClient *c, int nx) { void msetGenericCommand(client *c, int nx) {
int j, busykeys = 0; int j, busykeys = 0;
if ((c->argc % 2) == 0) { if ((c->argc % 2) == 0) {
...@@ -326,15 +326,15 @@ void msetGenericCommand(redisClient *c, int nx) { ...@@ -326,15 +326,15 @@ void msetGenericCommand(redisClient *c, int nx) {
addReply(c, nx ? shared.cone : shared.ok); addReply(c, nx ? shared.cone : shared.ok);
} }
void msetCommand(redisClient *c) { void msetCommand(client *c) {
msetGenericCommand(c,0); msetGenericCommand(c,0);
} }
void msetnxCommand(redisClient *c) { void msetnxCommand(client *c) {
msetGenericCommand(c,1); msetGenericCommand(c,1);
} }
void incrDecrCommand(redisClient *c, long long incr) { void incrDecrCommand(client *c, long long incr) {
long long value, oldvalue; long long value, oldvalue;
robj *o, *new; robj *o, *new;
...@@ -372,29 +372,29 @@ void incrDecrCommand(redisClient *c, long long incr) { ...@@ -372,29 +372,29 @@ void incrDecrCommand(redisClient *c, long long incr) {
addReply(c,shared.crlf); addReply(c,shared.crlf);
} }
void incrCommand(redisClient *c) { void incrCommand(client *c) {
incrDecrCommand(c,1); incrDecrCommand(c,1);
} }
void decrCommand(redisClient *c) { void decrCommand(client *c) {
incrDecrCommand(c,-1); incrDecrCommand(c,-1);
} }
void incrbyCommand(redisClient *c) { void incrbyCommand(client *c) {
long long incr; long long incr;
if (getLongLongFromObjectOrReply(c, c->argv[2], &incr, NULL) != REDIS_OK) return; if (getLongLongFromObjectOrReply(c, c->argv[2], &incr, NULL) != REDIS_OK) return;
incrDecrCommand(c,incr); incrDecrCommand(c,incr);
} }
void decrbyCommand(redisClient *c) { void decrbyCommand(client *c) {
long long incr; long long incr;
if (getLongLongFromObjectOrReply(c, c->argv[2], &incr, NULL) != REDIS_OK) return; if (getLongLongFromObjectOrReply(c, c->argv[2], &incr, NULL) != REDIS_OK) return;
incrDecrCommand(c,-incr); incrDecrCommand(c,-incr);
} }
void incrbyfloatCommand(redisClient *c) { void incrbyfloatCommand(client *c) {
long double incr, value; long double incr, value;
robj *o, *new, *aux; robj *o, *new, *aux;
...@@ -428,7 +428,7 @@ void incrbyfloatCommand(redisClient *c) { ...@@ -428,7 +428,7 @@ void incrbyfloatCommand(redisClient *c) {
rewriteClientCommandArgument(c,2,new); rewriteClientCommandArgument(c,2,new);
} }
void appendCommand(redisClient *c) { void appendCommand(client *c) {
size_t totlen; size_t totlen;
robj *o, *append; robj *o, *append;
...@@ -461,7 +461,7 @@ void appendCommand(redisClient *c) { ...@@ -461,7 +461,7 @@ void appendCommand(redisClient *c) {
addReplyLongLong(c,totlen); addReplyLongLong(c,totlen);
} }
void strlenCommand(redisClient *c) { void strlenCommand(client *c) {
robj *o; robj *o;
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL || if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
checkType(c,o,REDIS_STRING)) return; checkType(c,o,REDIS_STRING)) return;
......
...@@ -1196,7 +1196,7 @@ int zsetScore(robj *zobj, robj *member, double *score) { ...@@ -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_NX (1<<1) /* Don't touch elements not already existing. */
#define ZADD_XX (1<<2) /* Only touch elements already exisitng. */ #define ZADD_XX (1<<2) /* Only touch elements already exisitng. */
#define ZADD_CH (1<<3) /* Return num of elements added or updated. */ #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)"; static char *nanerr = "resulting score is not a number (NaN)";
robj *key = c->argv[1]; robj *key = c->argv[1];
robj *ele; robj *ele;
...@@ -1388,15 +1388,15 @@ cleanup: ...@@ -1388,15 +1388,15 @@ cleanup:
} }
} }
void zaddCommand(redisClient *c) { void zaddCommand(client *c) {
zaddGenericCommand(c,ZADD_NONE); zaddGenericCommand(c,ZADD_NONE);
} }
void zincrbyCommand(redisClient *c) { void zincrbyCommand(client *c) {
zaddGenericCommand(c,ZADD_INCR); zaddGenericCommand(c,ZADD_INCR);
} }
void zremCommand(redisClient *c) { void zremCommand(client *c) {
robj *key = c->argv[1]; robj *key = c->argv[1];
robj *zobj; robj *zobj;
int deleted = 0, keyremoved = 0, j; int deleted = 0, keyremoved = 0, j;
...@@ -1460,7 +1460,7 @@ void zremCommand(redisClient *c) { ...@@ -1460,7 +1460,7 @@ void zremCommand(redisClient *c) {
#define ZRANGE_RANK 0 #define ZRANGE_RANK 0
#define ZRANGE_SCORE 1 #define ZRANGE_SCORE 1
#define ZRANGE_LEX 2 #define ZRANGE_LEX 2
void zremrangeGenericCommand(redisClient *c, int rangetype) { void zremrangeGenericCommand(client *c, int rangetype) {
robj *key = c->argv[1]; robj *key = c->argv[1];
robj *zobj; robj *zobj;
int keyremoved = 0; int keyremoved = 0;
...@@ -1560,15 +1560,15 @@ cleanup: ...@@ -1560,15 +1560,15 @@ cleanup:
if (rangetype == ZRANGE_LEX) zslFreeLexRange(&lexrange); if (rangetype == ZRANGE_LEX) zslFreeLexRange(&lexrange);
} }
void zremrangebyrankCommand(redisClient *c) { void zremrangebyrankCommand(client *c) {
zremrangeGenericCommand(c,ZRANGE_RANK); zremrangeGenericCommand(c,ZRANGE_RANK);
} }
void zremrangebyscoreCommand(redisClient *c) { void zremrangebyscoreCommand(client *c) {
zremrangeGenericCommand(c,ZRANGE_SCORE); zremrangeGenericCommand(c,ZRANGE_SCORE);
} }
void zremrangebylexCommand(redisClient *c) { void zremrangebylexCommand(client *c) {
zremrangeGenericCommand(c,ZRANGE_LEX); zremrangeGenericCommand(c,ZRANGE_LEX);
} }
...@@ -1922,7 +1922,7 @@ inline static void zunionInterAggregate(double *target, double val, int aggregat ...@@ -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; int i, j;
long setnum; long setnum;
int aggregate = REDIS_AGGR_SUM; int aggregate = REDIS_AGGR_SUM;
...@@ -2163,15 +2163,15 @@ void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) { ...@@ -2163,15 +2163,15 @@ void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) {
zfree(src); zfree(src);
} }
void zunionstoreCommand(redisClient *c) { void zunionstoreCommand(client *c) {
zunionInterGenericCommand(c,c->argv[1], REDIS_OP_UNION); zunionInterGenericCommand(c,c->argv[1], REDIS_OP_UNION);
} }
void zinterstoreCommand(redisClient *c) { void zinterstoreCommand(client *c) {
zunionInterGenericCommand(c,c->argv[1], REDIS_OP_INTER); 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 *key = c->argv[1];
robj *zobj; robj *zobj;
int withscores = 0; int withscores = 0;
...@@ -2273,16 +2273,16 @@ void zrangeGenericCommand(redisClient *c, int reverse) { ...@@ -2273,16 +2273,16 @@ void zrangeGenericCommand(redisClient *c, int reverse) {
} }
} }
void zrangeCommand(redisClient *c) { void zrangeCommand(client *c) {
zrangeGenericCommand(c,0); zrangeGenericCommand(c,0);
} }
void zrevrangeCommand(redisClient *c) { void zrevrangeCommand(client *c) {
zrangeGenericCommand(c,1); zrangeGenericCommand(c,1);
} }
/* This command implements ZRANGEBYSCORE, ZREVRANGEBYSCORE. */ /* This command implements ZRANGEBYSCORE, ZREVRANGEBYSCORE. */
void genericZrangebyscoreCommand(redisClient *c, int reverse) { void genericZrangebyscoreCommand(client *c, int reverse) {
zrangespec range; zrangespec range;
robj *key = c->argv[1]; robj *key = c->argv[1];
robj *zobj; robj *zobj;
...@@ -2468,15 +2468,15 @@ void genericZrangebyscoreCommand(redisClient *c, int reverse) { ...@@ -2468,15 +2468,15 @@ void genericZrangebyscoreCommand(redisClient *c, int reverse) {
setDeferredMultiBulkLength(c, replylen, rangelen); setDeferredMultiBulkLength(c, replylen, rangelen);
} }
void zrangebyscoreCommand(redisClient *c) { void zrangebyscoreCommand(client *c) {
genericZrangebyscoreCommand(c,0); genericZrangebyscoreCommand(c,0);
} }
void zrevrangebyscoreCommand(redisClient *c) { void zrevrangebyscoreCommand(client *c) {
genericZrangebyscoreCommand(c,1); genericZrangebyscoreCommand(c,1);
} }
void zcountCommand(redisClient *c) { void zcountCommand(client *c) {
robj *key = c->argv[1]; robj *key = c->argv[1];
robj *zobj; robj *zobj;
zrangespec range; zrangespec range;
...@@ -2553,7 +2553,7 @@ void zcountCommand(redisClient *c) { ...@@ -2553,7 +2553,7 @@ void zcountCommand(redisClient *c) {
addReplyLongLong(c, count); addReplyLongLong(c, count);
} }
void zlexcountCommand(redisClient *c) { void zlexcountCommand(client *c) {
robj *key = c->argv[1]; robj *key = c->argv[1];
robj *zobj; robj *zobj;
zlexrangespec range; zlexrangespec range;
...@@ -2633,7 +2633,7 @@ void zlexcountCommand(redisClient *c) { ...@@ -2633,7 +2633,7 @@ void zlexcountCommand(redisClient *c) {
} }
/* This command implements ZRANGEBYLEX, ZREVRANGEBYLEX. */ /* This command implements ZRANGEBYLEX, ZREVRANGEBYLEX. */
void genericZrangebylexCommand(redisClient *c, int reverse) { void genericZrangebylexCommand(client *c, int reverse) {
zlexrangespec range; zlexrangespec range;
robj *key = c->argv[1]; robj *key = c->argv[1];
robj *zobj; robj *zobj;
...@@ -2809,15 +2809,15 @@ void genericZrangebylexCommand(redisClient *c, int reverse) { ...@@ -2809,15 +2809,15 @@ void genericZrangebylexCommand(redisClient *c, int reverse) {
setDeferredMultiBulkLength(c, replylen, rangelen); setDeferredMultiBulkLength(c, replylen, rangelen);
} }
void zrangebylexCommand(redisClient *c) { void zrangebylexCommand(client *c) {
genericZrangebylexCommand(c,0); genericZrangebylexCommand(c,0);
} }
void zrevrangebylexCommand(redisClient *c) { void zrevrangebylexCommand(client *c) {
genericZrangebylexCommand(c,1); genericZrangebylexCommand(c,1);
} }
void zcardCommand(redisClient *c) { void zcardCommand(client *c) {
robj *key = c->argv[1]; robj *key = c->argv[1];
robj *zobj; robj *zobj;
...@@ -2827,7 +2827,7 @@ void zcardCommand(redisClient *c) { ...@@ -2827,7 +2827,7 @@ void zcardCommand(redisClient *c) {
addReplyLongLong(c,zsetLength(zobj)); addReplyLongLong(c,zsetLength(zobj));
} }
void zscoreCommand(redisClient *c) { void zscoreCommand(client *c) {
robj *key = c->argv[1]; robj *key = c->argv[1];
robj *zobj; robj *zobj;
double score; double score;
...@@ -2842,7 +2842,7 @@ void zscoreCommand(redisClient *c) { ...@@ -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 *key = c->argv[1];
robj *ele = c->argv[2]; robj *ele = c->argv[2];
robj *zobj; robj *zobj;
...@@ -2904,15 +2904,15 @@ void zrankGenericCommand(redisClient *c, int reverse) { ...@@ -2904,15 +2904,15 @@ void zrankGenericCommand(redisClient *c, int reverse) {
} }
} }
void zrankCommand(redisClient *c) { void zrankCommand(client *c) {
zrankGenericCommand(c, 0); zrankGenericCommand(c, 0);
} }
void zrevrankCommand(redisClient *c) { void zrevrankCommand(client *c) {
zrankGenericCommand(c, 1); zrankGenericCommand(c, 1);
} }
void zscanCommand(redisClient *c) { void zscanCommand(client *c) {
robj *o; robj *o;
unsigned long cursor; unsigned long cursor;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment