lib: refactor the type of funcs which have useless return and checks

Some internal functions always return CURLE_OK.

- Curl_http_proxy_get_destination() does that from bb4032a, (2 years
  ago) And the original inline code does not need to check the status.

- Curl_wildcard_init() does that from e60fe20. (8 years ago)

- Curl_initinfo() does that from a very beginning.

- Curl_pgrsSetDownloadCounter() did not have a return before 914e49b,
  ad051e1 recovered its content (2 years ago) but did not completely
  recovered the changes related to it.

- auth_digest_get_qop_values() does that from 676de7f.

This directly changes their type to void and cleaned the remaining
checks for their return value.

Closes #19386
This commit is contained in:
x2018 2025-11-07 01:59:00 +08:00 committed by Daniel Stenberg
parent 2684af257e
commit 608d96694b
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
13 changed files with 20 additions and 42 deletions

View file

@ -167,9 +167,9 @@ static CURLcode dynhds_add_custom(struct Curl_easy *data,
return CURLE_OK;
}
CURLcode Curl_http_proxy_get_destination(struct Curl_cfilter *cf,
const char **phostname,
int *pport, bool *pipv6_ip)
void Curl_http_proxy_get_destination(struct Curl_cfilter *cf,
const char **phostname,
int *pport, bool *pipv6_ip)
{
DEBUGASSERT(cf);
DEBUGASSERT(cf->conn);
@ -192,8 +192,6 @@ CURLcode Curl_http_proxy_get_destination(struct Curl_cfilter *cf,
*pipv6_ip = (strchr(*phostname, ':') != NULL);
else
*pipv6_ip = cf->conn->bits.ipv6_ip;
return CURLE_OK;
}
struct cf_proxy_ctx {
@ -214,9 +212,7 @@ CURLcode Curl_http_proxy_create_CONNECT(struct httpreq **preq,
CURLcode result;
struct httpreq *req = NULL;
result = Curl_http_proxy_get_destination(cf, &hostname, &port, &ipv6_ip);
if(result)
goto out;
Curl_http_proxy_get_destination(cf, &hostname, &port, &ipv6_ip);
authority = curl_maprintf("%s%s%s:%d", ipv6_ip ? "[" : "", hostname,
ipv6_ip ?"]" : "", port);