Skip to content

Commit

Permalink
Change addReplyErrorFormat to addReplyError when there is no format
Browse files Browse the repository at this point in the history
This is just a cleanup, although they are both correct, the change
is normatively better, and addReplyError is also much faster.
  • Loading branch information
enjoy-binbin committed Oct 9, 2023
1 parent b810384 commit 9f3a8a0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2819,8 +2819,7 @@ void aclCommand(client *c) {
sds username = c->argv[2]->ptr;
/* Check username validity. */
if (ACLStringHasSpaces(username,sdslen(username))) {
addReplyErrorFormat(c,
"Usernames can't contain spaces or null characters");
addReplyError(c, "Usernames can't contain spaces or null characters");
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/geo.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ void georadiusGeneric(client *c, int srcKeyIndex, int flags) {
}

if (any && !count) {
addReplyErrorFormat(c, "the ANY argument requires COUNT argument");
addReplyError(c, "the ANY argument requires COUNT argument");
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/replication.c
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ void replconfCommand(client *c) {
int filter_count, i;
sds *filters;
if (!(filters = sdssplitargs(c->argv[j+1]->ptr, &filter_count))) {
addReplyErrorFormat(c, "Missing rdb-filter-only values");
addReplyError(c, "Missing rdb-filter-only values");
return;
}
/* By default filter out all parts of the rdb */
Expand Down
2 changes: 1 addition & 1 deletion src/script_lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ static void luaReplyToRedisReply(client *c, client* script_client, lua_State *lu
* to push 4 elements to the stack. On failure, return error.
* Notice that we need, in the worst case, 4 elements because returning a map might
* require push 4 elements to the Lua stack.*/
addReplyErrorFormat(c, "reached lua stack limit");
addReplyError(c, "reached lua stack limit");
lua_pop(lua,1); /* pop the element from the stack */
return;
}
Expand Down

0 comments on commit 9f3a8a0

Please sign in to comment.