tidy-up: prefer ifdef/ifndef for single checks

Closes #18018
This commit is contained in:
Viktor Szakats 2025-07-25 14:31:16 +02:00
parent b2bccdc257
commit 89771d19d5
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
109 changed files with 319 additions and 324 deletions

View file

@ -42,7 +42,7 @@ static int test_resolve(int argc, char *argv[])
while(argc > arg) {
if(!strcmp("--version", argv[arg])) {
printf("resolve IPv4%s\n",
#if defined(CURLRES_IPV6)
#ifdef CURLRES_IPV6
"/IPv6"
#else
""
@ -51,7 +51,7 @@ static int test_resolve(int argc, char *argv[])
return 0;
}
else if(!strcmp("--ipv6", argv[arg])) {
#if defined(CURLRES_IPV6)
#ifdef CURLRES_IPV6
ipv_inuse = "IPv6";
use_ipv6 = TRUE;
arg++;
@ -63,7 +63,7 @@ static int test_resolve(int argc, char *argv[])
else if(!strcmp("--ipv4", argv[arg])) {
/* for completeness, we support this option as well */
ipv_inuse = "IPv4";
#if defined(CURLRES_IPV6)
#ifdef CURLRES_IPV6
use_ipv6 = FALSE;
#endif
arg++;
@ -76,7 +76,7 @@ static int test_resolve(int argc, char *argv[])
puts("Usage: resolve [option] <host>\n"
" --version\n"
" --ipv4"
#if defined(CURLRES_IPV6)
#ifdef CURLRES_IPV6
"\n --ipv6"
#endif
);
@ -88,7 +88,7 @@ static int test_resolve(int argc, char *argv[])
return 2;
#endif
#if defined(CURLRES_IPV6)
#ifdef CURLRES_IPV6
if(use_ipv6) {
/* Check that the system has IPv6 enabled before checking the resolver */
curl_socket_t s = socket(PF_INET6, SOCK_DGRAM, 0);