Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Sarthak Aggarwal <[email protected]>
  • Loading branch information
sarthakaggarwal97 committed Dec 4, 2024
1 parent 86d4f41 commit 07eaf76
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/t_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,15 @@ int parseExtendedStringArgumentsOrReply(client *c, int *flags, int *unit, robj *
!(*flags & OBJ_SET_NX || *flags & OBJ_SET_IFEQ) && (command_type == COMMAND_SET))
{
*flags |= OBJ_SET_XX;
} else if ((opt[0] == 'i' || opt[0] == 'I') &&
(opt[1] == 'f' || opt[1] == 'F') &&
(opt[2] == 'e' || opt[2] == 'E') &&
(opt[3] == 'q' || opt[3] == 'Q') && opt[4] == '\0' &&
next && !(*flags & OBJ_SET_NX || *flags & OBJ_SET_XX) && (command_type == COMMAND_SET))
{
*flags |= OBJ_SET_IFEQ;
*compare_val = next;
j++;
} else if ((opt[0] == 'g' || opt[0] == 'G') &&
(opt[1] == 'e' || opt[1] == 'E') &&
(opt[2] == 't' || opt[2] == 'T') && opt[3] == '\0' &&
Expand Down Expand Up @@ -317,17 +326,7 @@ int parseExtendedStringArgumentsOrReply(client *c, int *flags, int *unit, robj *
*unit = UNIT_MILLISECONDS;
*expire = next;
j++;
} else if ((opt[0] == 'i' || opt[0] == 'I') &&
(opt[1] == 'f' || opt[1] == 'F') &&
(opt[2] == 'e' || opt[2] == 'E') &&
(opt[3] == 'q' || opt[3] == 'Q') && opt[4] == '\0' &&
next && !(*flags & OBJ_SET_NX || *flags & OBJ_SET_XX) && (command_type == COMMAND_SET))
{
*flags |= OBJ_SET_IFEQ;
*compare_val = next;
j++;
}
else {
} else {
addReplyErrorObject(c,shared.syntaxerr);
return C_ERR;
}
Expand All @@ -336,8 +335,9 @@ int parseExtendedStringArgumentsOrReply(client *c, int *flags, int *unit, robj *
return C_OK;
}

/* SET key value [NX | XX | IFEQ comparison-value] [KEEPTTL] [GET] [EX <seconds>]
* [PX <milliseconds>] [EXAT <seconds-timestamp>][PXAT <milliseconds-timestamp>] */
/* SET key value [NX | XX | IFEQ comparison-value] [GET]
* [EX seconds | PX milliseconds |
* EXAT seconds-timestamp | PXAT milliseconds-timestamp | KEEPTTL] */
void setCommand(client *c) {
robj *expire = NULL;
robj *comparison = NULL;
Expand Down

0 comments on commit 07eaf76

Please sign in to comment.