Unverified Commit e216c839 authored by Binbin's avatar Binbin Committed by GitHub
Browse files

Change addReplyErrorFormat to addReplyError when there is no format (#12641)

This is just a cleanup, although they are both correct, the change
is normatively better, and addReplyError is also much faster.
Although not important, speed is not important for these error cases.
parent 423565f7
...@@ -2819,8 +2819,7 @@ void aclCommand(client *c) { ...@@ -2819,8 +2819,7 @@ void aclCommand(client *c) {
sds username = c->argv[2]->ptr; sds username = c->argv[2]->ptr;
/* Check username validity. */ /* Check username validity. */
if (ACLStringHasSpaces(username,sdslen(username))) { if (ACLStringHasSpaces(username,sdslen(username))) {
addReplyErrorFormat(c, addReplyError(c, "Usernames can't contain spaces or null characters");
"Usernames can't contain spaces or null characters");
return; return;
} }
......
...@@ -690,7 +690,7 @@ void georadiusGeneric(client *c, int srcKeyIndex, int flags) { ...@@ -690,7 +690,7 @@ void georadiusGeneric(client *c, int srcKeyIndex, int flags) {
} }
if (any && !count) { if (any && !count) {
addReplyErrorFormat(c, "the ANY argument requires COUNT argument"); addReplyError(c, "the ANY argument requires COUNT argument");
return; return;
} }
......
...@@ -1259,7 +1259,7 @@ void replconfCommand(client *c) { ...@@ -1259,7 +1259,7 @@ void replconfCommand(client *c) {
int filter_count, i; int filter_count, i;
sds *filters; sds *filters;
if (!(filters = sdssplitargs(c->argv[j+1]->ptr, &filter_count))) { 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; return;
} }
/* By default filter out all parts of the rdb */ /* By default filter out all parts of the rdb */
......
...@@ -602,7 +602,7 @@ static void luaReplyToRedisReply(client *c, client* script_client, lua_State *lu ...@@ -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. * 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 * Notice that we need, in the worst case, 4 elements because returning a map might
* require push 4 elements to the Lua stack.*/ * 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 */ lua_pop(lua,1); /* pop the element from the stack */
return; return;
} }
......
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