From: Viktor Szakats Date: Tue, 18 Feb 2025 13:24:59 +0000 (+0100) Subject: tidy-up: alphasort lists, indentation/whitespace, pp X-Git-Tag: curl-8_13_0~286 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=387311012cf977f479d94f097c3030a27517fcf9;p=thirdparty%2Fcurl.git tidy-up: alphasort lists, indentation/whitespace, pp - cmake/win32-cache: alphasort items. - configure.ac: alphasort `CURL_CHECK_FUNC_*` checks. - configure.ac: alphasort `AC_CHECK_FUNCS` checks. - prefer `#ifdef`/`#ifndef`. - lib/asyn-thread: drop unused value of `USE_HTTPSRR_ARES`. - lib/formdata: drop unused header `libgen.h`. - indentation, whitespace. Closes #16490 --- diff --git a/CMake/win32-cache.cmake b/CMake/win32-cache.cmake index a7070dca21..75c8ce69ba 100644 --- a/CMake/win32-cache.cmake +++ b/CMake/win32-cache.cmake @@ -25,35 +25,33 @@ if(NOT WIN32) message(FATAL_ERROR "This file should be included on Windows platform only") endif() -set(HAVE_LOCALE_H 1) - if(MINGW) - set(HAVE_SNPRINTF 1) - set(HAVE_UNISTD_H 1) + set(HAVE_BASENAME 1) + set(HAVE_BOOL_T 1) # = HAVE_STDBOOL_H + set(HAVE_DIRENT_H 1) + set(HAVE_FTRUNCATE 1) + set(HAVE_GETTIMEOFDAY 1) set(HAVE_LIBGEN_H 1) + set(HAVE_OPENDIR 1) + set(HAVE_SNPRINTF 1) + set(HAVE_STDBOOL_H 1) set(HAVE_STDDEF_H 1) # detected by CMake internally in check_type_size() set(HAVE_STDINT_H 1) # detected by CMake internally in check_type_size() - set(HAVE_STDBOOL_H 1) - set(HAVE_BOOL_T "${HAVE_STDBOOL_H}") - set(HAVE_BASENAME 1) - set(HAVE_FTRUNCATE 1) + set(HAVE_STRINGS_H 1) # wrapper to string.h set(HAVE_SYS_PARAM_H 1) set(HAVE_SYS_TIME_H 1) - set(HAVE_GETTIMEOFDAY 1) - set(HAVE_STRINGS_H 1) # wrapper to string.h + set(HAVE_UNISTD_H 1) set(HAVE_UTIME_H 1) # wrapper to sys/utime.h - set(HAVE_DIRENT_H 1) - set(HAVE_OPENDIR 1) else() - set(HAVE_LIBGEN_H 0) + set(HAVE_DIRENT_H 0) set(HAVE_FTRUNCATE 0) - set(HAVE_SYS_PARAM_H 0) - set(HAVE_SYS_TIME_H 0) set(HAVE_GETTIMEOFDAY 0) + set(HAVE_LIBGEN_H 0) + set(HAVE_OPENDIR 0) set(HAVE_STRINGS_H 0) + set(HAVE_SYS_PARAM_H 0) + set(HAVE_SYS_TIME_H 0) set(HAVE_UTIME_H 0) - set(HAVE_DIRENT_H 0) - set(HAVE_OPENDIR 0) if(MSVC) set(HAVE_UNISTD_H 0) set(HAVE_STDDEF_H 1) # detected by CMake internally in check_type_size() @@ -87,52 +85,82 @@ else() set(HAVE_ATOMIC 0) endif() -# Available in Windows XP and newer -set(HAVE_GETADDRINFO 1) -set(HAVE_FREEADDRINFO 1) - -set(HAVE_SOCKETPAIR 0) -set(HAVE_SENDMSG 0) -set(HAVE_SENDMMSG 0) set(HAVE_ALARM 0) +set(HAVE_ARC4RANDOM 0) +set(HAVE_ARPA_INET_H 0) +set(HAVE_CLOSESOCKET 1) +set(HAVE_EVENTFD 0) set(HAVE_FCNTL 0) +set(HAVE_FCNTL_H 1) +set(HAVE_FCNTL_O_NONBLOCK 0) +set(HAVE_FNMATCH 0) +set(HAVE_FREEADDRINFO 1) # Available in Windows XP and newer +set(HAVE_FSETXATTR 0) +set(HAVE_GETADDRINFO 1) # Available in Windows XP and newer +set(HAVE_GETEUID 0) +set(HAVE_GETHOSTBYNAME_R 0) +set(HAVE_GETHOSTBYNAME_R_3 0) +set(HAVE_GETHOSTBYNAME_R_3_REENTRANT 0) +set(HAVE_GETHOSTBYNAME_R_5 0) +set(HAVE_GETHOSTBYNAME_R_5_REENTRANT 0) +set(HAVE_GETHOSTBYNAME_R_6 0) +set(HAVE_GETHOSTBYNAME_R_6_REENTRANT 0) +set(HAVE_GETHOSTNAME 1) +set(HAVE_GETIFADDRS 0) +set(HAVE_GETPASS_R 0) +set(HAVE_GETPEERNAME 1) set(HAVE_GETPPID 0) -set(HAVE_UTIMES 0) +set(HAVE_GETPWUID 0) set(HAVE_GETPWUID_R 0) -set(HAVE_STRERROR_R 0) -set(HAVE_SIGINTERRUPT 0) -set(HAVE_PIPE 0) -set(HAVE_EVENTFD 0) -set(HAVE_IF_NAMETOINDEX 0) set(HAVE_GETRLIMIT 0) -set(HAVE_SETRLIMIT 0) -set(HAVE_FSETXATTR 0) -set(HAVE_SETLOCALE 1) -set(HAVE_SETMODE 1) -set(HAVE__SETMODE 1) -set(HAVE_GETPEERNAME 1) set(HAVE_GETSOCKNAME 1) -set(HAVE_GETHOSTNAME 1) - -set(HAVE_RECV 1) -set(HAVE_SEND 1) -set(HAVE_STROPTS_H 0) -set(HAVE_ARC4RANDOM 0) -set(HAVE_FNMATCH 0) -set(HAVE_ARPA_INET_H 0) -set(HAVE_FCNTL_H 1) +set(HAVE_GLIBC_STRERROR_R 0) +set(HAVE_GMTIME_R 0) set(HAVE_IFADDRS_H 0) +set(HAVE_IF_NAMETOINDEX 0) +set(HAVE_IOCTLSOCKET 1) +set(HAVE_IOCTLSOCKET_CAMEL 0) +set(HAVE_IOCTLSOCKET_CAMEL_FIONBIO 0) +set(HAVE_IOCTLSOCKET_FIONBIO 1) +set(HAVE_IOCTL_FIONBIO 0) +set(HAVE_IOCTL_SIOCGIFADDR 0) set(HAVE_IO_H 1) +set(HAVE_LINUX_TCP_H 0) +set(HAVE_LOCALE_H 1) +set(HAVE_MEMRCHR 0) +set(HAVE_MSG_NOSIGNAL 0) set(HAVE_NETDB_H 0) -set(HAVE_NETINET_IN_H 0) set(HAVE_NETINET_IN6_H 0) +set(HAVE_NETINET_IN_H 0) set(HAVE_NETINET_TCP_H 0) set(HAVE_NETINET_UDP_H 0) set(HAVE_NET_IF_H 0) -set(HAVE_IOCTL_SIOCGIFADDR 0) -set(HAVE_POLL_H 0) +set(HAVE_PIPE 0) set(HAVE_POLL 0) +set(HAVE_POLL_H 0) +set(HAVE_POSIX_STRERROR_R 0) set(HAVE_PWD_H 0) +set(HAVE_RECV 1) +set(HAVE_SELECT 1) +set(HAVE_SEND 1) +set(HAVE_SENDMMSG 0) +set(HAVE_SENDMSG 0) +set(HAVE_SETLOCALE 1) +set(HAVE_SETMODE 1) +set(HAVE_SETRLIMIT 0) +set(HAVE_SETSOCKOPT_SO_NONBLOCK 0) +set(HAVE_SIGACTION 0) +set(HAVE_SIGINTERRUPT 0) +set(HAVE_SIGNAL 1) +set(HAVE_SIGSETJMP 0) +set(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1) +set(HAVE_SOCKET 1) +set(HAVE_SOCKETPAIR 0) +set(HAVE_STRDUP 1) +set(HAVE_STRERROR_R 0) +set(HAVE_STROPTS_H 0) +set(HAVE_STRUCT_SOCKADDR_STORAGE 1) +set(HAVE_STRUCT_TIMEVAL 1) set(HAVE_SYS_EVENTFD_H 0) set(HAVE_SYS_FILIO_H 0) set(HAVE_SYS_IOCTL_H 0) @@ -147,49 +175,16 @@ set(HAVE_SYS_UN_H 0) set(HAVE_SYS_UTIME_H 1) set(HAVE_TERMIOS_H 0) set(HAVE_TERMIO_H 0) -set(HAVE_LINUX_TCP_H 0) - -set(HAVE_SOCKET 1) -set(HAVE_SELECT 1) -set(HAVE_STRDUP 1) -set(HAVE_MEMRCHR 0) -set(HAVE_CLOSESOCKET 1) -set(HAVE_SIGSETJMP 0) -set(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1) -set(HAVE_GETPASS_R 0) -set(HAVE_GETPWUID 0) -set(HAVE_GETEUID 0) -set(HAVE_UTIME 1) -set(HAVE_GMTIME_R 0) -set(HAVE_GETHOSTBYNAME_R 0) -set(HAVE_SIGNAL 1) -set(HAVE_SIGACTION 0) -set(HAVE_GLIBC_STRERROR_R 0) -set(HAVE_GETIFADDRS 0) -set(HAVE_FCNTL_O_NONBLOCK 0) -set(HAVE_IOCTLSOCKET 1) -set(HAVE_IOCTLSOCKET_CAMEL 0) -set(HAVE_IOCTLSOCKET_CAMEL_FIONBIO 0) -set(HAVE_IOCTLSOCKET_FIONBIO 1) -set(HAVE_IOCTL_FIONBIO 0) -set(HAVE_SETSOCKOPT_SO_NONBLOCK 0) -set(HAVE_POSIX_STRERROR_R 0) -set(HAVE_MSG_NOSIGNAL 0) -set(HAVE_STRUCT_TIMEVAL 1) -set(HAVE_STRUCT_SOCKADDR_STORAGE 1) set(HAVE_TIME_T_UNSIGNED 0) - -set(HAVE_GETHOSTBYNAME_R_3 0) -set(HAVE_GETHOSTBYNAME_R_3_REENTRANT 0) -set(HAVE_GETHOSTBYNAME_R_5 0) -set(HAVE_GETHOSTBYNAME_R_5_REENTRANT 0) -set(HAVE_GETHOSTBYNAME_R_6 0) -set(HAVE_GETHOSTBYNAME_R_6_REENTRANT 0) - +set(HAVE_UTIME 1) +set(HAVE_UTIMES 0) +set(HAVE__SETMODE 1) set(STDC_HEADERS 1) -set(HAVE_SIZEOF_SUSECONDS_T 0) +# Types and sizes + set(HAVE_SIZEOF_SA_FAMILY_T 0) +set(HAVE_SIZEOF_SUSECONDS_T 0) if(MINGW OR MSVC) curl_prefill_type_size("INT" 4) @@ -222,14 +217,16 @@ if(MINGW OR MSVC) endif() endif() -if(WINCE) # Windows CE exceptions - set(HAVE_LOCALE_H 0) - set(HAVE_GETADDRINFO 0) +# Windows CE exceptions + +if(WINCE) set(HAVE_FREEADDRINFO 0) + set(HAVE_GETADDRINFO 0) + set(HAVE_LOCALE_H 0) set(HAVE_SETLOCALE 0) - set(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 0) - set(HAVE_SIGNAL 0) set(HAVE_SETMODE 0) + set(HAVE_SIGNAL 0) + set(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 0) curl_prefill_type_size("CURL_SOCKET_T" 4) curl_prefill_type_size("TIME_T" 4) curl_prefill_type_size("SIZE_T" 4) diff --git a/configure.ac b/configure.ac index 6146412e74..a4e09e6655 100644 --- a/configure.ac +++ b/configure.ac @@ -4071,9 +4071,9 @@ CURL_CHECK_FUNC_FTRUNCATE CURL_CHECK_FUNC_GETADDRINFO CURL_CHECK_FUNC_GETHOSTBYNAME_R CURL_CHECK_FUNC_GETHOSTNAME +CURL_CHECK_FUNC_GETIFADDRS CURL_CHECK_FUNC_GETPEERNAME CURL_CHECK_FUNC_GETSOCKNAME -CURL_CHECK_FUNC_GETIFADDRS CURL_CHECK_FUNC_GMTIME_R CURL_CHECK_FUNC_INET_NTOP CURL_CHECK_FUNC_INET_PTON @@ -4111,8 +4111,8 @@ AC_CHECK_FUNCS([\ mach_absolute_time \ pipe \ poll \ - sendmsg \ sendmmsg \ + sendmsg \ setlocale \ setrlimit \ snprintf \ diff --git a/include/curl/curl.h b/include/curl/curl.h index 39db4160db..c80708f3f0 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -42,7 +42,7 @@ !defined(CURL_DISABLE_DEPRECATION) && !defined(BUILDING_LIBCURL) #define CURL_DEPRECATED(version, message) \ __attribute__((deprecated("since " # version ". " message))) -#if defined(__IAR_SYSTEMS_ICC__) +#ifdef __IAR_SYSTEMS_ICC__ #define CURL_IGNORE_DEPRECATION(statements) \ _Pragma("diag_suppress=Pe1444") \ statements \ @@ -97,7 +97,7 @@ #include #endif -#if !defined(_WIN32) +#ifndef _WIN32 #include #include #endif diff --git a/include/curl/system.h b/include/curl/system.h index f647f85870..589b21dbc8 100644 --- a/include/curl/system.h +++ b/include/curl/system.h @@ -52,7 +52,7 @@ * */ -#if defined(__DJGPP__) +#ifdef __DJGPP__ # define CURL_TYPEOF_CURL_OFF_T long long # define CURL_FORMAT_CURL_OFF_T "lld" # define CURL_FORMAT_CURL_OFF_TU "llu" diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c index 25dc7a90ac..bf7f144ad5 100644 --- a/lib/asyn-thread.c +++ b/lib/asyn-thread.c @@ -69,7 +69,7 @@ #ifdef USE_ARES #include #ifdef USE_HTTPSRR -#define USE_HTTPSRR_ARES 1 /* the combo */ +#define USE_HTTPSRR_ARES /* the combo */ #endif #endif diff --git a/lib/cf-socket.c b/lib/cf-socket.c index ec8a76e1aa..e22da3f3bd 100644 --- a/lib/cf-socket.c +++ b/lib/cf-socket.c @@ -115,8 +115,8 @@ static void tcpnodelay(struct Curl_easy *data, curl_socket_t sockfd) int level = IPPROTO_TCP; char buffer[STRERROR_LEN]; - if(setsockopt(sockfd, level, TCP_NODELAY, (void *)&onoff, - sizeof(onoff)) < 0) + if(setsockopt(sockfd, level, TCP_NODELAY, + (void *)&onoff, sizeof(onoff)) < 0) infof(data, "Could not set TCP_NODELAY: %s", Curl_strerror(SOCKERRNO, buffer, sizeof(buffer))); #else @@ -135,8 +135,8 @@ static void nosigpipe(struct Curl_easy *data, { int onoff = 1; (void)data; - if(setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&onoff, - sizeof(onoff)) < 0) { + if(setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, + (void *)&onoff, sizeof(onoff)) < 0) { #if !defined(CURL_DISABLE_VERBOSE_STRINGS) char buffer[STRERROR_LEN]; infof(data, "Could not set SO_NOSIGPIPE: %s", @@ -183,7 +183,7 @@ tcpkeepalive(struct Curl_easy *data, /* only set IDLE and INTVL if setting KEEPALIVE is successful */ if(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, - (void *)&optval, sizeof(optval)) < 0) { + (void *)&optval, sizeof(optval)) < 0) { infof(data, "Failed to set SO_KEEPALIVE on fd " "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); @@ -236,7 +236,7 @@ tcpkeepalive(struct Curl_easy *data, optval = curlx_sltosi(data->set.tcp_keepidle); KEEPALIVE_FACTOR(optval); if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE, - (void *)&optval, sizeof(optval)) < 0) { + (void *)&optval, sizeof(optval)) < 0) { infof(data, "Failed to set TCP_KEEPIDLE on fd " "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); @@ -246,7 +246,7 @@ tcpkeepalive(struct Curl_easy *data, optval = curlx_sltosi(data->set.tcp_keepidle); KEEPALIVE_FACTOR(optval); if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE, - (void *)&optval, sizeof(optval)) < 0) { + (void *)&optval, sizeof(optval)) < 0) { infof(data, "Failed to set TCP_KEEPALIVE on fd " "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); @@ -256,7 +256,7 @@ tcpkeepalive(struct Curl_easy *data, optval = curlx_sltosi(data->set.tcp_keepidle); KEEPALIVE_FACTOR(optval); if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE_THRESHOLD, - (void *)&optval, sizeof(optval)) < 0) { + (void *)&optval, sizeof(optval)) < 0) { infof(data, "Failed to set TCP_KEEPALIVE_THRESHOLD on fd " "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); @@ -266,7 +266,7 @@ tcpkeepalive(struct Curl_easy *data, optval = curlx_sltosi(data->set.tcp_keepintvl); KEEPALIVE_FACTOR(optval); if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL, - (void *)&optval, sizeof(optval)) < 0) { + (void *)&optval, sizeof(optval)) < 0) { infof(data, "Failed to set TCP_KEEPINTVL on fd " "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); @@ -287,7 +287,7 @@ tcpkeepalive(struct Curl_easy *data, curlx_sltosi(data->set.tcp_keepintvl); KEEPALIVE_FACTOR(optval); if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE_ABORT_THRESHOLD, - (void *)&optval, sizeof(optval)) < 0) { + (void *)&optval, sizeof(optval)) < 0) { infof(data, "Failed to set TCP_KEEPALIVE_ABORT_THRESHOLD on fd " "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); } @@ -295,7 +295,7 @@ tcpkeepalive(struct Curl_easy *data, #ifdef TCP_KEEPCNT optval = curlx_sltosi(data->set.tcp_keepcnt); if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPCNT, - (void *)&optval, sizeof(optval)) < 0) { + (void *)&optval, sizeof(optval)) < 0) { infof(data, "Failed to set TCP_KEEPCNT on fd " "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); } diff --git a/lib/cfilters.h b/lib/cfilters.h index 0b9098a5d1..ac88a0da53 100644 --- a/lib/cfilters.h +++ b/lib/cfilters.h @@ -65,10 +65,10 @@ typedef CURLcode Curl_cft_connect(struct Curl_cfilter *cf, * @param pport on return, contains the port number */ typedef void Curl_cft_get_host(struct Curl_cfilter *cf, - struct Curl_easy *data, - const char **phost, - const char **pdisplay_host, - int *pport); + struct Curl_easy *data, + const char **phost, + const char **pdisplay_host, + int *pport); struct easy_pollset; @@ -96,8 +96,8 @@ struct easy_pollset; * @param ps the pollset (inout) for the easy handle */ typedef void Curl_cft_adjust_pollset(struct Curl_cfilter *cf, - struct Curl_easy *data, - struct easy_pollset *ps); + struct Curl_easy *data, + struct easy_pollset *ps); typedef bool Curl_cft_data_pending(struct Curl_cfilter *cf, const struct Curl_easy *data); @@ -245,8 +245,8 @@ void Curl_cf_def_get_host(struct Curl_cfilter *cf, struct Curl_easy *data, const char **phost, const char **pdisplay_host, int *pport); void Curl_cf_def_adjust_pollset(struct Curl_cfilter *cf, - struct Curl_easy *data, - struct easy_pollset *ps); + struct Curl_easy *data, + struct easy_pollset *ps); bool Curl_cf_def_data_pending(struct Curl_cfilter *cf, const struct Curl_easy *data); ssize_t Curl_cf_def_send(struct Curl_cfilter *cf, struct Curl_easy *data, @@ -255,8 +255,8 @@ ssize_t Curl_cf_def_send(struct Curl_cfilter *cf, struct Curl_easy *data, ssize_t Curl_cf_def_recv(struct Curl_cfilter *cf, struct Curl_easy *data, char *buf, size_t len, CURLcode *err); CURLcode Curl_cf_def_cntrl(struct Curl_cfilter *cf, - struct Curl_easy *data, - int event, int arg1, void *arg2); + struct Curl_easy *data, + int event, int arg1, void *arg2); bool Curl_cf_def_conn_is_alive(struct Curl_cfilter *cf, struct Curl_easy *data, bool *input_pending); diff --git a/lib/curl_multibyte.h b/lib/curl_multibyte.h index dec384e2fe..539b5136bc 100644 --- a/lib/curl_multibyte.h +++ b/lib/curl_multibyte.h @@ -25,7 +25,7 @@ ***************************************************************************/ #include "curl_setup.h" -#if defined(_WIN32) +#ifdef _WIN32 /* * MultiByte conversions using Windows kernel32 library. diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 724aa7f32b..e01c35007e 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -56,7 +56,7 @@ # endif #endif -#if defined(__APPLE__) +#ifdef __APPLE__ #include #include /* Fixup faulty target macro initialization in macOS SDK since v14.4 (as of @@ -276,7 +276,7 @@ * When HTTP is disabled, disable HTTP-only features */ -#if defined(CURL_DISABLE_HTTP) +#ifdef CURL_DISABLE_HTTP # define CURL_DISABLE_ALTSVC 1 # define CURL_DISABLE_COOKIES 1 # define CURL_DISABLE_BASIC_AUTH 1 @@ -771,7 +771,7 @@ #endif /* Single point where USE_NTLM definition might be defined */ -#if !defined(CURL_DISABLE_NTLM) +#ifndef CURL_DISABLE_NTLM # if defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \ defined(USE_GNUTLS) || defined(USE_SECTRANSP) || \ defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \ @@ -811,7 +811,7 @@ /* noreturn attribute */ -#if !defined(CURL_NORETURN) +#ifndef CURL_NORETURN #if (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__clang__) || \ defined(__IAR_SYSTEMS_ICC__) # define CURL_NORETURN __attribute__((__noreturn__)) @@ -824,7 +824,7 @@ /* fallthrough attribute */ -#if !defined(FALLTHROUGH) +#ifndef FALLTHROUGH #if (defined(__GNUC__) && __GNUC__ >= 7) || \ (defined(__clang__) && __clang_major__ >= 10) # define FALLTHROUGH() __attribute__((fallthrough)) @@ -1032,7 +1032,7 @@ int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, # endif #endif -#if defined(CURL_INLINE) +#ifdef CURL_INLINE /* 'CURL_INLINE' defined, use as-is */ #elif defined(inline) # define CURL_INLINE inline /* 'inline' defined, assumed correct */ diff --git a/lib/curl_setup_once.h b/lib/curl_setup_once.h index 016355b109..96d399766a 100644 --- a/lib/curl_setup_once.h +++ b/lib/curl_setup_once.h @@ -125,7 +125,7 @@ struct timeval { #endif -#if defined(__minix) +#ifdef __minix /* Minix does not support recv on TCP sockets */ #define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \ (RECV_TYPE_ARG2)(y), \ @@ -165,12 +165,11 @@ struct timeval { #endif /* HAVE_RECV */ -#if defined(__minix) +#ifdef __minix /* Minix does not support send on TCP sockets */ #define swrite(x,y,z) (ssize_t)write((SEND_TYPE_ARG1)(x), \ - (SEND_TYPE_ARG2)(y), \ - (SEND_TYPE_ARG3)(z)) - + (SEND_TYPE_ARG2)(y), \ + (SEND_TYPE_ARG3)(z)) #elif defined(HAVE_SEND) #define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \ (SEND_QUAL_ARG2 SEND_TYPE_ARG2)(y), \ @@ -187,7 +186,7 @@ struct timeval { * Function-like macro definition used to close a socket. */ -#if defined(HAVE_CLOSESOCKET) +#ifdef HAVE_CLOSESOCKET # define sclose(x) closesocket((x)) #elif defined(HAVE_CLOSESOCKET_CAMEL) # define sclose(x) CloseSocket((x)) @@ -202,7 +201,7 @@ struct timeval { /* * Stack-independent version of fcntl() on sockets: */ -#if defined(USE_LWIPSOCK) +#ifdef USE_LWIPSOCK # define sfcntl lwip_fcntl #else # define sfcntl fcntl @@ -286,7 +285,7 @@ typedef unsigned int bit; */ #undef DEBUGASSERT -#if defined(DEBUGBUILD) +#ifdef DEBUGBUILD #define DEBUGASSERT(x) assert(x) #else #define DEBUGASSERT(x) do { } while(0) diff --git a/lib/formdata.c b/lib/formdata.c index 7ea7a8f396..436509d5ee 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -31,10 +31,6 @@ struct Curl_easy; #include "formdata.h" #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_FORM_API) -#if defined(HAVE_LIBGEN_H) && defined(HAVE_BASENAME) -#include -#endif - #include "urldata.h" /* for struct Curl_easy */ #include "mime.h" #include "vtls/vtls.h" diff --git a/lib/md4.c b/lib/md4.c index 8a3c884415..c60281cb8f 100644 --- a/lib/md4.c +++ b/lib/md4.c @@ -314,10 +314,10 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx); #else #define MD4_SET(n) \ (ctx->block[(n)] = \ - (MD4_u32plus)ptr[(n) * 4] | \ - ((MD4_u32plus)ptr[(n) * 4 + 1] << 8) | \ - ((MD4_u32plus)ptr[(n) * 4 + 2] << 16) | \ - ((MD4_u32plus)ptr[(n) * 4 + 3] << 24)) + (MD4_u32plus)ptr[(n) * 4] | \ + ((MD4_u32plus)ptr[(n) * 4 + 1] << 8) | \ + ((MD4_u32plus)ptr[(n) * 4 + 2] << 16) | \ + ((MD4_u32plus)ptr[(n) * 4 + 3] << 24)) #define MD4_GET(n) \ (ctx->block[(n)]) #endif diff --git a/lib/mprintf.c b/lib/mprintf.c index 29464876cc..09b21bc998 100644 --- a/lib/mprintf.c +++ b/lib/mprintf.c @@ -1189,7 +1189,6 @@ int curl_mprintf(const char *format, ...) int retcode; va_list ap_save; /* argument pointer */ va_start(ap_save, format); - retcode = formatf(stdout, fputc_wrapper, format, ap_save); va_end(ap_save); return retcode; diff --git a/lib/system_win32.c b/lib/system_win32.c index bfe1606776..7a9551d3f6 100644 --- a/lib/system_win32.c +++ b/lib/system_win32.c @@ -24,7 +24,7 @@ #include "curl_setup.h" -#if defined(_WIN32) +#ifdef _WIN32 #include #include "system_win32.h" diff --git a/lib/system_win32.h b/lib/system_win32.h index 024d959f32..b8333c647e 100644 --- a/lib/system_win32.h +++ b/lib/system_win32.h @@ -26,7 +26,7 @@ #include "curl_setup.h" -#if defined(_WIN32) +#ifdef _WIN32 #include diff --git a/lib/timeval.c b/lib/timeval.c index bb29bfdfee..890992efce 100644 --- a/lib/timeval.c +++ b/lib/timeval.c @@ -24,7 +24,7 @@ #include "timeval.h" -#if defined(_WIN32) +#ifdef _WIN32 #include #include "system_win32.h" @@ -42,12 +42,12 @@ struct curltime Curl_now(void) } else { /* Disable /analyze warning that GetTickCount64 is preferred */ -#if defined(_MSC_VER) +#ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:28159) #endif DWORD milliseconds = GetTickCount(); -#if defined(_MSC_VER) +#ifdef _MSC_VER #pragma warning(pop) #endif diff --git a/lib/url.c b/lib/url.c index a841cfdb6e..3b1ce3568e 100644 --- a/lib/url.c +++ b/lib/url.c @@ -427,7 +427,7 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data) */ if(Curl_ssl_backend() != CURLSSLBACKEND_SCHANNEL && Curl_ssl_backend() != CURLSSLBACKEND_SECURETRANSPORT) { -#if defined(CURL_CA_BUNDLE) +#ifdef CURL_CA_BUNDLE result = Curl_setstropt(&set->str[STRING_SSL_CAFILE], CURL_CA_BUNDLE); if(result) return result; @@ -438,7 +438,7 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data) return result; #endif #endif -#if defined(CURL_CA_PATH) +#ifdef CURL_CA_PATH result = Curl_setstropt(&set->str[STRING_SSL_CAPATH], CURL_CA_PATH); if(result) return result; @@ -1127,7 +1127,7 @@ static bool url_match_conn(struct connectdata *conn, void *userdata) } } -#if defined(USE_NTLM) +#ifdef USE_NTLM /* If we are looking for an HTTP+NTLM connection, check if this is already authenticating with the right credentials. If not, keep looking so that we can reuse NTLM connections if @@ -1307,7 +1307,7 @@ void Curl_verboseconnect(struct Curl_easy *data, infof(data, "Connected to %s (%s) port %u", CURL_CONN_HOST_DISPNAME(conn), conn->primary.remote_ip, conn->primary.remote_port); -#if !defined(CURL_DISABLE_HTTP) +#ifndef CURL_DISABLE_HTTP if(conn->handler->protocol & PROTO_FAMILY_HTTP) { switch(conn->alpn) { case CURL_HTTP_VERSION_3: @@ -1462,7 +1462,7 @@ const struct Curl_handler *Curl_getn_scheme_handler(const char *scheme, #else NULL, #endif -#if defined(USE_SSH) +#ifdef USE_SSH &Curl_handler_sftp, #else NULL, @@ -1709,7 +1709,7 @@ static void zonefrom_url(CURLU *uh, struct Curl_easy *data, if(!Curl_str_number(&p, &scope, UINT_MAX)) /* A plain number, use it directly as a scope id. */ conn->scope_id = (unsigned int)scope; -#if defined(HAVE_IF_NAMETOINDEX) +#ifdef HAVE_IF_NAMETOINDEX else { #elif defined(_WIN32) else if(Curl_if_nametoindex) { @@ -1718,7 +1718,7 @@ static void zonefrom_url(CURLU *uh, struct Curl_easy *data, #if defined(HAVE_IF_NAMETOINDEX) || defined(_WIN32) /* Zone identifier is not numeric */ unsigned int scopeidx = 0; -#if defined(_WIN32) +#ifdef _WIN32 scopeidx = Curl_if_nametoindex(zoneid); #else scopeidx = if_nametoindex(zoneid); @@ -2868,7 +2868,7 @@ static CURLcode parse_connect_to_host_port(struct Curl_easy *data, int port = -1; CURLcode result = CURLE_OK; -#if defined(CURL_DISABLE_VERBOSE_STRINGS) +#ifdef CURL_DISABLE_VERBOSE_STRINGS (void) data; #endif @@ -3687,7 +3687,7 @@ static CURLcode create_conn(struct Curl_easy *data, goto out; } -#if defined(USE_NTLM) +#ifdef USE_NTLM /* If NTLM is requested in a part of this connection, make sure we do not assume the state is fine as this is a fresh connection and NTLM is connection based. */ diff --git a/lib/urlapi.c b/lib/urlapi.c index 06adda1127..30fe0ba8c7 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -970,7 +970,7 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags) ptr += 9; /* now points to the slash after the host */ } else { -#if defined(_WIN32) +#ifdef _WIN32 size_t len; /* the hostname, NetBIOS computer name, can not contain disallowed diff --git a/lib/version_win32.c b/lib/version_win32.c index d58dbec724..ae3c74672a 100644 --- a/lib/version_win32.c +++ b/lib/version_win32.c @@ -24,7 +24,7 @@ #include "curl_setup.h" -#if defined(_WIN32) +#ifdef _WIN32 #include #include "version_win32.h" @@ -79,7 +79,7 @@ bool curlx_verify_windows_version(const unsigned int majorVersion, { bool matched = FALSE; -#if defined(CURL_WINDOWS_UWP) +#ifdef CURL_WINDOWS_UWP /* We have no way to determine the Windows version from Windows apps, so let's assume we are running on the target Windows version. */ const WORD fullVersion = MAKEWORD(minorVersion, majorVersion); diff --git a/lib/version_win32.h b/lib/version_win32.h index 95a9e7f215..a91631eb23 100644 --- a/lib/version_win32.h +++ b/lib/version_win32.h @@ -26,7 +26,7 @@ #include "curl_setup.h" -#if defined(_WIN32) +#ifdef _WIN32 /* Version condition */ typedef enum { diff --git a/lib/vtls/wolfssl.c b/lib/vtls/wolfssl.c index fca5a9f4fc..7da83b1201 100644 --- a/lib/vtls/wolfssl.c +++ b/lib/vtls/wolfssl.c @@ -959,7 +959,7 @@ CURLcode Curl_wssl_ctx_init(struct wssl_ctx *wctx, word16 pqkem = 0; size_t idx = 0; #endif - CURLcode result = CURLE_FAILED_INIT; + CURLcode result = CURLE_FAILED_INIT; DEBUGASSERT(!wctx->ssl_ctx); DEBUGASSERT(!wctx->ssl); diff --git a/lib/warnless.c b/lib/warnless.c index 0d608e46d6..218e518fd7 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -298,7 +298,7 @@ size_t curlx_sitouz(int sinum) #endif } -#if defined(_WIN32) +#ifdef _WIN32 ssize_t curlx_read(int fd, void *buf, size_t count) { diff --git a/lib/warnless.h b/lib/warnless.h index 63b473c571..11c5e8b0b8 100644 --- a/lib/warnless.h +++ b/lib/warnless.h @@ -57,7 +57,7 @@ unsigned short curlx_uitous(unsigned int uinum); size_t curlx_sitouz(int sinum); -#if defined(_WIN32) +#ifdef _WIN32 ssize_t curlx_read(int fd, void *buf, size_t count); @@ -70,7 +70,7 @@ ssize_t curlx_write(int fd, const void *buf, size_t count); #ifndef HEADER_CURL_WARNLESS_H_REDEFS #define HEADER_CURL_WARNLESS_H_REDEFS -#if defined(_WIN32) +#ifdef _WIN32 #undef read #define read(fd, buf, count) curlx_read(fd, buf, count) #undef write diff --git a/src/tool_setup.h b/src/tool_setup.h index cafe373ea8..57cd9a57fc 100644 --- a/src/tool_setup.h +++ b/src/tool_setup.h @@ -66,7 +66,7 @@ extern FILE *tool_stderr; # include "tool_strdup.h" #endif -#if defined(_WIN32) +#ifdef _WIN32 # define CURL_STRICMP(p1, p2) _stricmp(p1, p2) #elif defined(HAVE_STRCASECMP) # ifdef HAVE_STRINGS_H diff --git a/src/tool_util.c b/src/tool_util.c index c1891283b5..446bb7199c 100644 --- a/src/tool_util.c +++ b/src/tool_util.c @@ -28,7 +28,7 @@ #include "curlx.h" #include "memdebug.h" /* keep this as LAST include */ -#if defined(_WIN32) +#ifdef _WIN32 /* In case of bug fix this function has a counterpart in timeval.c */ struct timeval tvnow(void) @@ -43,12 +43,12 @@ struct timeval tvnow(void) } else { /* Disable /analyze warning that GetTickCount64 is preferred */ -#if defined(_MSC_VER) +#ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:28159) #endif DWORD milliseconds = GetTickCount(); -#if defined(_MSC_VER) +#ifdef _MSC_VER #pragma warning(pop) #endif @@ -121,7 +121,7 @@ struct timeval tvnow(void) #endif -#if defined(_WIN32) +#ifdef _WIN32 struct timeval tvrealnow(void) { diff --git a/tests/libtest/lib1531.c b/tests/libtest/lib1531.c index 2021e08790..ea250b607e 100644 --- a/tests/libtest/lib1531.c +++ b/tests/libtest/lib1531.c @@ -109,7 +109,7 @@ CURLcode test(char *URL) curl_multi_fdset() doc. */ if(maxfd == -1) { -#if defined(_WIN32) +#ifdef _WIN32 Sleep(100); rc = 0; #else diff --git a/tests/libtest/lib670.c b/tests/libtest/lib670.c index e03e8abebf..2a9c21f298 100644 --- a/tests/libtest/lib670.c +++ b/tests/libtest/lib670.c @@ -213,7 +213,7 @@ CURLcode test(char *URL) mres = curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcept, &maxfd); if(mres) break; -#if defined(_WIN32) +#ifdef _WIN32 if(maxfd == -1) Sleep(100); else diff --git a/tests/libtest/stub_gssapi.c b/tests/libtest/stub_gssapi.c index 7fcbb641fa..72f3d89db4 100644 --- a/tests/libtest/stub_gssapi.c +++ b/tests/libtest/stub_gssapi.c @@ -34,14 +34,14 @@ #define APPROX_TOKEN_LEN 250 enum min_err_code { - GSS_OK = 0, - GSS_NO_MEMORY, - GSS_INVALID_ARGS, - GSS_INVALID_CREDS, - GSS_INVALID_CTX, - GSS_SERVER_ERR, - GSS_NO_MECH, - GSS_LAST + GSS_OK = 0, + GSS_NO_MEMORY, + GSS_INVALID_ARGS, + GSS_INVALID_CREDS, + GSS_INVALID_CTX, + GSS_SERVER_ERR, + GSS_NO_MECH, + GSS_LAST }; static const char *min_err_table[] = { diff --git a/tests/libtest/testutil.c b/tests/libtest/testutil.c index 51593501ff..d058e9e4df 100644 --- a/tests/libtest/testutil.c +++ b/tests/libtest/testutil.c @@ -26,7 +26,7 @@ #include "testutil.h" #include "memdebug.h" -#if defined(_WIN32) +#ifdef _WIN32 struct timeval tutil_tvnow(void) { diff --git a/tests/server/util.c b/tests/server/util.c index d9f6d2162a..b3ffa71a49 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -245,7 +245,7 @@ int wait_ms(int timeout_ms) CURL_SETERRNO(EINVAL); return -1; } -#if defined(MSDOS) +#ifdef MSDOS delay(timeout_ms); #elif defined(USE_WINSOCK) Sleep((DWORD)timeout_ms); @@ -281,7 +281,7 @@ curl_off_t our_getpid(void) curl_off_t pid; pid = (curl_off_t)Curl_getpid(); -#if defined(_WIN32) +#ifdef _WIN32 /* store pid + MAX_PID to avoid conflict with Cygwin/msys PIDs, see also: * - 2019-01-31: https://cygwin.com/git/?p=newlib-cygwin.git;a=commit; ↵ * h=b5e1003722cb14235c4f166be72c09acdffc62ea @@ -367,7 +367,7 @@ void clear_advisor_read_lock(const char *filename) } -#if defined(_WIN32) +#ifdef _WIN32 static struct timeval tvnow(void) { diff --git a/tests/unit/unit1609.c b/tests/unit/unit1609.c index 04b53b0d72..c3b11d7a4d 100644 --- a/tests/unit/unit1609.c +++ b/tests/unit/unit1609.c @@ -105,9 +105,9 @@ UNITTEST_START struct Curl_easy *easy = NULL; struct curl_slist *list = NULL; -/* important: we setup cache outside of the loop - and also clean cache after the loop. In contrast,for example, - test 1607 sets up and cleans cache on each iteration. */ + /* important: we setup cache outside of the loop + and also clean cache after the loop. In contrast,for example, + test 1607 sets up and cleans cache on each iteration. */ for(i = 0; i < (int)CURL_ARRAYSIZE(tests); ++i) { int j;