diff options
author | Wen Hui <wen.hui.ware@gmail.com> | 2021-04-07 03:28:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-07 10:28:53 +0300 |
commit | d96f47cf06b1cc24b82109e0e87ac5428517525a (patch) | |
tree | 952ca82b6f14cae643847e8e63d358b7220951cd /src/t_list.c | |
parent | 4c14e8668cdfa6a967fd3be6e0a159d1156b7ef6 (diff) | |
download | redis-d96f47cf06b1cc24b82109e0e87ac5428517525a.tar.gz |
use getPositiveLongFromObjectOrReply for positive check of args (#8750)
just a cleanup
Diffstat (limited to 'src/t_list.c')
-rw-r--r-- | src/t_list.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/t_list.c b/src/t_list.c index 961f59ae4..f8ca27458 100644 --- a/src/t_list.c +++ b/src/t_list.c @@ -592,20 +592,14 @@ void lposCommand(client *c) { } } else if (!strcasecmp(opt,"COUNT") && moreargs) { j++; - if (getLongFromObjectOrReply(c, c->argv[j], &count, NULL) != C_OK) + if (getPositiveLongFromObjectOrReply(c, c->argv[j], &count, + "COUNT can't be negative") != C_OK) return; - if (count < 0) { - addReplyError(c,"COUNT can't be negative"); - return; - } } else if (!strcasecmp(opt,"MAXLEN") && moreargs) { j++; - if (getLongFromObjectOrReply(c, c->argv[j], &maxlen, NULL) != C_OK) + if (getPositiveLongFromObjectOrReply(c, c->argv[j], &maxlen, + "MAXLEN can't be negative") != C_OK) return; - if (maxlen < 0) { - addReplyError(c,"MAXLEN can't be negative"); - return; - } } else { addReplyErrorObject(c,shared.syntaxerr); return; |