From 96e3962fb4c3cd0cd2ddb02e8e0d3e728dea877e Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 26 Feb 2025 00:31:19 +0100 Subject: [PATCH] prefer #ifdef 2 --- tests/server/mqttd.c | 4 ++-- tests/server/resolve.c | 6 +++--- tests/server/sockfilt.c | 16 ++++++++-------- tests/server/socksd.c | 12 ++++++------ tests/server/sws.c | 32 ++++++++++++++++---------------- 5 files changed, 35 insertions(+), 35 deletions(-) diff --git a/tests/server/mqttd.c b/tests/server/mqttd.c index 7070a4f688..45ba0b6f41 100644 --- a/tests/server/mqttd.c +++ b/tests/server/mqttd.c @@ -740,12 +740,12 @@ static bool incoming(curl_socket_t listenfd) FD_ZERO(&fds_err); /* there's always a socket to wait for */ -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" #endif FD_SET(sockfd, &fds_read); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic pop #endif diff --git a/tests/server/resolve.c b/tests/server/resolve.c index b09d50368f..f13014afbf 100644 --- a/tests/server/resolve.c +++ b/tests/server/resolve.c @@ -64,7 +64,7 @@ int main(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 "" @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) puts("Usage: resolve [option] \n" " --version\n" " --ipv4" -#if defined(CURLRES_IPV6) +#ifdef CURLRES_IPV6 "\n --ipv6" #endif ); @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) atexit(win32_cleanup); #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); diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c index e164f5f2a5..b28bc919c3 100644 --- a/tests/server/sockfilt.c +++ b/tests/server/sockfilt.c @@ -1007,12 +1007,12 @@ static bool juggle(curl_socket_t *sockfdp, FD_ZERO(&fds_write); FD_ZERO(&fds_err); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" #endif FD_SET((curl_socket_t)fileno(stdin), &fds_read); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic pop #endif @@ -1023,12 +1023,12 @@ static bool juggle(curl_socket_t *sockfdp, /* server mode */ sockfd = listenfd; /* there's always a socket to wait for */ -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" #endif FD_SET(sockfd, &fds_read); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic pop #endif maxfd = (int)sockfd; @@ -1044,12 +1044,12 @@ static bool juggle(curl_socket_t *sockfdp, } else { /* there's always a socket to wait for */ -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" #endif FD_SET(sockfd, &fds_read); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic pop #endif maxfd = (int)sockfd; @@ -1061,12 +1061,12 @@ static bool juggle(curl_socket_t *sockfdp, sockfd = *sockfdp; /* sockfd turns CURL_SOCKET_BAD when our connection has been closed */ if(CURL_SOCKET_BAD != sockfd) { -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" #endif FD_SET(sockfd, &fds_read); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic pop #endif maxfd = (int)sockfd; diff --git a/tests/server/socksd.c b/tests/server/socksd.c index f63ffdb51b..e8eb2a4a17 100644 --- a/tests/server/socksd.c +++ b/tests/server/socksd.c @@ -707,35 +707,35 @@ static bool incoming(curl_socket_t listenfd) FD_ZERO(&fds_err); /* there's always a socket to wait for */ -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" #endif FD_SET(sockfd, &fds_read); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic pop #endif for(i = 0; i < 2; i++) { if(c[i].used) { curl_socket_t fd = c[i].clientfd; -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" #endif FD_SET(fd, &fds_read); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic pop #endif if((int)fd > maxfd) maxfd = (int)fd; fd = c[i].remotefd; -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" #endif FD_SET(fd, &fds_read); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic pop #endif if((int)fd > maxfd) diff --git a/tests/server/sws.c b/tests/server/sws.c index c42bfe90b5..d13945a244 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -901,12 +901,12 @@ static int get_request(curl_socket_t sock, struct httprequest *req) FD_ZERO(&input); FD_ZERO(&output); got = 0; -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" #endif FD_SET(sock, &input); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic pop #endif do { @@ -1377,12 +1377,12 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port) timeout.tv_sec = 1; /* 1000 ms */ FD_ZERO(&output); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" #endif FD_SET(serverfd, &output); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic pop #endif while(1) { @@ -1509,12 +1509,12 @@ static void http_connect(curl_socket_t *infdp, /* listener socket is monitored to allow client to establish secondary tunnel only when this tunnel is not established and primary one is fully operational */ -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" #endif FD_SET(rootfd, &input); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic pop #endif maxfd = rootfd; @@ -1526,12 +1526,12 @@ static void http_connect(curl_socket_t *infdp, if(clientfd[i] != CURL_SOCKET_BAD) { if(poll_client_rd[i]) { /* unless told not to do so, monitor readability */ -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" #endif FD_SET(clientfd[i], &input); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic pop #endif if(clientfd[i] > maxfd) @@ -1540,12 +1540,12 @@ static void http_connect(curl_socket_t *infdp, if(poll_client_wr[i] && toc[i]) { /* unless told not to do so, monitor writability if there is data ready to be sent to client */ -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" #endif FD_SET(clientfd[i], &output); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic pop #endif if(clientfd[i] > maxfd) @@ -1556,12 +1556,12 @@ static void http_connect(curl_socket_t *infdp, if(serverfd[i] != CURL_SOCKET_BAD) { if(poll_server_rd[i]) { /* unless told not to do so, monitor readability */ -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" #endif FD_SET(serverfd[i], &input); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic pop #endif if(serverfd[i] > maxfd) @@ -1570,12 +1570,12 @@ static void http_connect(curl_socket_t *infdp, if(poll_server_wr[i] && tos[i]) { /* unless told not to do so, monitor writability if there is data ready to be sent to server */ -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" #endif FD_SET(serverfd[i], &output); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic pop #endif if(serverfd[i] > maxfd) @@ -2389,12 +2389,12 @@ int main(int argc, char *argv[]) for(socket_idx = 0; socket_idx < num_sockets; ++socket_idx) { /* Listen on all sockets */ -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" #endif FD_SET(all_sockets[socket_idx], &input); -#if defined(__DJGPP__) +#ifdef __DJGPP__ #pragma GCC diagnostic pop #endif if(all_sockets[socket_idx] > maxfd)