]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
progress: remove two redundant variable checks
authorDaniel Stenberg <daniel@haxx.se>
Tue, 25 Nov 2025 08:09:50 +0000 (09:09 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 25 Nov 2025 08:40:13 +0000 (09:40 +0100)
The entry condition in the function already exits early if either
low_speed_time or low_speed_limit is not set.

Pointed out by CodeSonar

Closes #19686

lib/progress.c

index 3985e1c1bfbd03b5bf4fe038bb75fe98cf6ed41b..59c5b9a00f280a69e9a1df22a900c95ccf00d7bc 100644 (file)
@@ -109,7 +109,7 @@ UNITTEST CURLcode pgrs_speedcheck(struct Curl_easy *data,
     /* A paused transfer is not qualified for speed checks */
     return CURLE_OK;
 
-  if((data->progress.current_speed >= 0) && data->set.low_speed_time) {
+  if(data->progress.current_speed >= 0) {
     if(data->progress.current_speed < data->set.low_speed_limit) {
       if(!data->state.keeps_speed.tv_sec)
         /* under the limit at this moment */
@@ -134,10 +134,9 @@ UNITTEST CURLcode pgrs_speedcheck(struct Curl_easy *data,
       data->state.keeps_speed.tv_sec = 0;
   }
 
-  if(data->set.low_speed_limit)
-    /* if low speed limit is enabled, set the expire timer to make this
-       connection's speed get checked again in a second */
-    Curl_expire(data, 1000, EXPIRE_SPEEDCHECK);
+  /* since low speed limit is enabled, set the expire timer to make this
+     connection's speed get checked again in a second */
+  Curl_expire(data, 1000, EXPIRE_SPEEDCHECK);
 
   return CURLE_OK;
 }