]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
hostip: remove unnecessary leftover INT_MAX check in Curl_dnscache_prune
authorDaniel Stenberg <daniel@haxx.se>
Mon, 22 Sep 2025 08:30:15 +0000 (10:30 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 24 Sep 2025 12:11:36 +0000 (14:11 +0200)
The math already uses timediff_t so no need for the extra logic

Ref: #18678
Closes #18680

lib/hostip.c

index fd8f706e7f253a79f73db3bf791a0472f25f5a97..da260d713009a57b03246d3b89938369650b0d04 100644 (file)
@@ -279,13 +279,9 @@ void Curl_dnscache_prune(struct Curl_easy *data)
     /* Remove outdated and unused entries from the hostcache */
     timediff_t oldest_ms = dnscache_prune(&dnscache->entries, timeout_ms, now);
 
-    if(Curl_hash_count(&dnscache->entries) > MAX_DNS_CACHE_SIZE) {
-      if(oldest_ms < INT_MAX)
-        /* prune the ones over half this age */
-        timeout_ms = (int)oldest_ms / 2;
-      else
-        timeout_ms = INT_MAX/2;
-    }
+    if(Curl_hash_count(&dnscache->entries) > MAX_DNS_CACHE_SIZE)
+      /* prune the ones over half this age */
+      timeout_ms = oldest_ms / 2;
     else
       break;