tool_getparam: avoid redundant condition in set_rate

When the number parsing fails, the pointer is never moved so there's no
point in checking that.

Pointed out by CodeSonar

Closes #16895
This commit is contained in:
Daniel Stenberg 2025-04-01 10:25:41 +02:00
parent 50c1e62fa4
commit 49a87e93c3
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -992,17 +992,10 @@ static ParameterError set_rate(struct GlobalConfig *global,
if(div) {
curl_off_t numunits;
const char *s;
div++;
s = div;
if(curlx_str_number(&div, &numunits, CURL_OFF_T_MAX)) {
if(s == div)
/* if div did not move, accept it as a 1 */
numunits = 1;
else
return PARAM_BAD_USE;
}
if(curlx_str_number(&div, &numunits, CURL_OFF_T_MAX))
numunits = 1;
switch(*div) {
case 's': /* per second */