prefer #ifdef/#ifndef 1
This commit is contained in:
parent
212dd2a1b6
commit
bfc7ad3a32
@ -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 <sys/select.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#ifndef _WIN32
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
***************************************************************************/
|
||||
#include "curl_setup.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
|
||||
/*
|
||||
* MultiByte conversions using Windows kernel32 library.
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#ifdef __APPLE__
|
||||
#include <sys/types.h>
|
||||
#include <TargetConditionals.h>
|
||||
/* 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 */
|
||||
|
||||
@ -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,7 +165,7 @@ 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), \
|
||||
@ -187,7 +187,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 +202,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
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
#include "curl_setup.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include "system_win32.h"
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
#include "curl_setup.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
#include "timeval.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <curl/curl.h>
|
||||
#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
|
||||
|
||||
|
||||
18
lib/url.c
18
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
|
||||
|
||||
@ -3689,7 +3689,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. */
|
||||
|
||||
@ -998,7 +998,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
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
#include "curl_setup.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <curl/curl.h>
|
||||
#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);
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
#include "curl_setup.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
|
||||
/* Version condition */
|
||||
typedef enum {
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
#include "testutil.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
|
||||
struct timeval tutil_tvnow(void)
|
||||
{
|
||||
|
||||
@ -243,7 +243,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);
|
||||
@ -279,7 +279,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
|
||||
@ -365,7 +365,7 @@ void clear_advisor_read_lock(const char *filename)
|
||||
}
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
|
||||
static struct timeval tvnow(void)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user