summaryrefslogtreecommitdiff
path: root/src/t_string.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-10-22 12:24:02 +0200
committerantirez <antirez@gmail.com>2018-10-22 12:24:02 +0200
commitc33ef454f09b4e6eefcad77b773d112223837c36 (patch)
tree278fc89bcc09c1bd70ff9c9bff78e491dabdbbc3 /src/t_string.c
parentf30b18f4de94e3235546b1dc8fe2be2028be2b80 (diff)
downloadredis-c33ef454f09b4e6eefcad77b773d112223837c36.tar.gz
Remove useless complexity from MSET implementation.
Diffstat (limited to 'src/t_string.c')
-rw-r--r--src/t_string.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/t_string.c b/src/t_string.c
index e121df73e..db6f7aa61 100644
--- a/src/t_string.c
+++ b/src/t_string.c
@@ -301,24 +301,22 @@ void mgetCommand(client *c) {
}
void msetGenericCommand(client *c, int nx) {
- int j, busykeys = 0;
+ int j;
if ((c->argc % 2) == 0) {
addReplyError(c,"wrong number of arguments for MSET");
return;
}
+
/* Handle the NX flag. The MSETNX semantic is to return zero and don't
- * set nothing at all if at least one already key exists. */
+ * set anything if at least one key alerady exists. */
if (nx) {
for (j = 1; j < c->argc; j += 2) {
if (lookupKeyWrite(c->db,c->argv[j]) != NULL) {
- busykeys++;
+ addReply(c, shared.czero);
+ return;
}
}
- if (busykeys) {
- addReply(c, shared.czero);
- return;
- }
}
for (j = 1; j < c->argc; j += 2) {