]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib: fix unused parameter/function compiler warnings
authorViktor Szakats <commit@vsz.me>
Fri, 4 Jul 2025 13:45:23 +0000 (15:45 +0200)
committerViktor Szakats <commit@vsz.me>
Fri, 4 Jul 2025 14:46:53 +0000 (16:46 +0200)
- hostip: fix unused variable with `CURL_DISABLE_SHUFFLE_DNS`
  ```
  lib/hostip.c: In function 'Curl_dnscache_mk_entry':
  lib/hostip.c:490:42: warning: unused parameter 'data' [-Wunused-parameter]
    490 | Curl_dnscache_mk_entry(struct Curl_easy *data,
        |                        ~~~~~~~~~~~~~~~~~~^~~~
  ```

- setopt: fix unused function with `CURL_DISABLE_HTTP`
  ```
  lib/setopt.c:214:17: warning: 'httpauth' defined but not used [-Wunused-function]
    214 | static CURLcode httpauth(struct Curl_easy *data, bool proxy,
        |                 ^~~~~~~~
  ```

- url: fix unused function with `CURL_DISABLE_NETRC`
  ```
  lib/url.c:2760:13: warning: 'str_has_ctrl' defined but not used [-Wunused-function]
   2760 | static bool str_has_ctrl(const char *input)
        |             ^~~~~~~~~~~~
  ```

Seen with a minimal curl-for-win build:
```
CW_CONFIG=dev-x64-zero-osnotls-osnoidn-nohttp-nocurltool-linux-unity
```

Closes #17818

lib/hostip.c
lib/setopt.c
lib/url.c

index 58855328d4de17fceb5a8336ba57237371b13df0..191aaeb8de98434ded241b201f743f660c5b7788 100644 (file)
@@ -505,6 +505,8 @@ Curl_dnscache_mk_entry(struct Curl_easy *data,
       return NULL;
     }
   }
+#else
+  (void)data;
 #endif
   if(!hostlen)
     hostlen = strlen(hostname);
index eecfd5532657d322c6fb90b77ca7b9127a61d249..1380c33db6faeb0de0e2e5693e466d619476e2ae 100644 (file)
@@ -240,6 +240,7 @@ static CURLcode protocol2num(const char *str, curl_prot_t *val)
   return CURLE_OK;
 }
 
+#if !defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_PROXY)
 static CURLcode httpauth(struct Curl_easy *data, bool proxy,
                          unsigned long auth)
 {
@@ -284,6 +285,7 @@ static CURLcode httpauth(struct Curl_easy *data, bool proxy,
     data->set.httpauth = auth;
   return CURLE_OK;
 }
+#endif /* !CURL_DISABLE_HTTP || !CURL_DISABLE_PROXY */
 
 #ifndef CURL_DISABLE_HTTP
 static CURLcode setopt_HTTP_VERSION(struct Curl_easy *data, long arg)
index 56c88810f8e1b245c9c02c8638e6c8ff72cb75be..977b6a604922fbc63911e95a36569d4f94efeeeb 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -2760,6 +2760,7 @@ static CURLcode parse_remote_port(struct Curl_easy *data,
   return CURLE_OK;
 }
 
+#ifndef CURL_DISABLE_NETRC
 static bool str_has_ctrl(const char *input)
 {
   if(input) {
@@ -2772,6 +2773,7 @@ static bool str_has_ctrl(const char *input)
   }
   return FALSE;
 }
+#endif
 
 /*
  * Override the login details from the URL with that in the CURLOPT_USERPWD