mirror of
https://github.com/fluencelabs/redis
synced 2025-06-18 19:51:22 +00:00
Convert objects in the command procs instead of the protocol code
This commit is contained in:
@ -178,6 +178,7 @@ void saddCommand(redisClient *c) {
|
||||
robj *set;
|
||||
|
||||
set = lookupKeyWrite(c->db,c->argv[1]);
|
||||
c->argv[2] = tryObjectEncoding(c->argv[2]);
|
||||
if (set == NULL) {
|
||||
set = setTypeCreate(c->argv[2]);
|
||||
dbAdd(c->db,c->argv[1],set);
|
||||
@ -202,6 +203,7 @@ void sremCommand(redisClient *c) {
|
||||
if ((set = lookupKeyWriteOrReply(c,c->argv[1],shared.czero)) == NULL ||
|
||||
checkType(c,set,REDIS_SET)) return;
|
||||
|
||||
c->argv[2] = tryObjectEncoding(c->argv[2]);
|
||||
if (setTypeRemove(set,c->argv[2])) {
|
||||
if (setTypeSize(set) == 0) dbDelete(c->db,c->argv[1]);
|
||||
touchWatchedKey(c->db,c->argv[1]);
|
||||
@ -216,7 +218,7 @@ void smoveCommand(redisClient *c) {
|
||||
robj *srcset, *dstset, *ele;
|
||||
srcset = lookupKeyWrite(c->db,c->argv[1]);
|
||||
dstset = lookupKeyWrite(c->db,c->argv[2]);
|
||||
ele = c->argv[3];
|
||||
ele = c->argv[3] = tryObjectEncoding(c->argv[3]);
|
||||
|
||||
/* If the source key does not exist return 0 */
|
||||
if (srcset == NULL) {
|
||||
@ -264,6 +266,7 @@ void sismemberCommand(redisClient *c) {
|
||||
if ((set = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
|
||||
checkType(c,set,REDIS_SET)) return;
|
||||
|
||||
c->argv[2] = tryObjectEncoding(c->argv[2]);
|
||||
if (setTypeIsMember(set,c->argv[2]))
|
||||
addReply(c,shared.cone);
|
||||
else
|
||||
|
Reference in New Issue
Block a user