]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_getparam: avoid redundant condition in set_rate
authorDaniel Stenberg <daniel@haxx.se>
Tue, 1 Apr 2025 08:25:41 +0000 (10:25 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 1 Apr 2025 12:29:04 +0000 (14:29 +0200)
When the number parsing fails, the pointer is never moved so there's no
point in checking that.

Pointed out by CodeSonar

Closes #16895

src/tool_getparam.c

index e5272de74feb5e8f09917a6d6a88508dac61ec98..a55973a60ae1b6f0ec836cd050eacef2ea2343d1 100644 (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 */