use getPositiveLongFromObjectOrReply for positive check in spop (#8146)
This is a cleanup commit that doesn't fix any bug, however it does change the error response text in case the user provided a negative number.
This commit is contained in:
parent
6bb5503524
commit
09b7f6c2a1
@ -457,13 +457,8 @@ void spopWithCountCommand(client *c) {
|
|||||||
robj *set;
|
robj *set;
|
||||||
|
|
||||||
/* Get the count argument */
|
/* Get the count argument */
|
||||||
if (getLongFromObjectOrReply(c,c->argv[2],&l,NULL) != C_OK) return;
|
if (getPositiveLongFromObjectOrReply(c,c->argv[2],&l,NULL) != C_OK) return;
|
||||||
if (l >= 0) {
|
|
||||||
count = (unsigned long) l;
|
count = (unsigned long) l;
|
||||||
} else {
|
|
||||||
addReply(c,shared.outofrangeerr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make sure a key with the name inputted exists, and that it's type is
|
/* Make sure a key with the name inputted exists, and that it's type is
|
||||||
* indeed a set. Otherwise, return nil */
|
* indeed a set. Otherwise, return nil */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user