From: Daniel Stenberg Date: Mon, 24 Oct 2022 21:27:31 +0000 (+0200) Subject: misc: remove duplicated include files X-Git-Tag: curl-7_87_0~234 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=279834dd45008a44a3028e20f82f8a9f4401a40d;p=thirdparty%2Fcurl.git misc: remove duplicated include files Closes #9796 --- diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c index 8b375eb5ee..e121c516fe 100644 --- a/lib/asyn-thread.c +++ b/lib/asyn-thread.c @@ -75,7 +75,6 @@ #include "inet_ntop.h" #include "curl_threads.h" #include "connect.h" -#include "socketpair.h" /* The last 3 #include files should be in this order */ #include "curl_printf.h" #include "curl_memory.h" diff --git a/lib/easy.c b/lib/easy.c index b8ac1ef8a8..b61ea7b7c5 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -71,7 +71,6 @@ #include "mime.h" #include "amigaos.h" #include "warnless.h" -#include "multiif.h" #include "sigpipe.h" #include "vssh/ssh.h" #include "setopt.h" diff --git a/lib/ftp.c b/lib/ftp.c index f1a25b23dc..082593348b 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -74,7 +74,6 @@ #include "sockaddr.h" /* required for Curl_sockaddr_storage */ #include "multiif.h" #include "url.h" -#include "strcase.h" #include "speedcheck.h" #include "warnless.h" #include "http_proxy.h" diff --git a/lib/hsts.c b/lib/hsts.c index e3b686ebfa..330fe37ac5 100644 --- a/lib/hsts.c +++ b/lib/hsts.c @@ -39,7 +39,6 @@ #include "parsedate.h" #include "fopen.h" #include "rename.h" -#include "strtoofft.h" /* The last 3 #include files should be in this order */ #include "curl_printf.h" diff --git a/lib/http_aws_sigv4.c b/lib/http_aws_sigv4.c index 440eb385f8..70832c0097 100644 --- a/lib/http_aws_sigv4.c +++ b/lib/http_aws_sigv4.c @@ -32,8 +32,6 @@ #include "http_aws_sigv4.h" #include "curl_sha256.h" #include "transfer.h" - -#include "strcase.h" #include "parsedate.h" #include "sendf.h" diff --git a/lib/imap.c b/lib/imap.c index ffa08bf7a4..9420d00e59 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -79,7 +79,6 @@ #include "select.h" #include "multiif.h" #include "url.h" -#include "strcase.h" #include "bufref.h" #include "curl_sasl.h" #include "warnless.h" diff --git a/lib/md4.c b/lib/md4.c index e976fe7bdc..c13b080d69 100644 --- a/lib/md4.c +++ b/lib/md4.c @@ -26,10 +26,11 @@ #if !defined(CURL_DISABLE_CRYPTO_AUTH) +#include + #include "curl_md4.h" #include "warnless.h" - #ifdef USE_OPENSSL #include #if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3) && \ @@ -53,21 +54,44 @@ #else #include #endif - #if(MBEDTLS_VERSION_NUMBER >= 0x02070000) #define HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS #endif #endif /* USE_MBEDTLS */ #if defined(USE_GNUTLS) - #include +/* When OpenSSL or wolfSSL is available, we use their MD4 functions. */ +#elif defined(USE_WOLFSSL) && !defined(WOLFSSL_NO_MD4) +#include +#elif defined(USE_OPENSSL) && !defined(OPENSSL_NO_MD4) +#include +#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \ + (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) && \ + defined(__MAC_OS_X_VERSION_MIN_ALLOWED) && \ + (__MAC_OS_X_VERSION_MIN_ALLOWED < 101500)) || \ + (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \ + (__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000)) +#define AN_APPLE_OS +#include +#elif defined(USE_WIN32_CRYPTO) +#include +#elif(defined(USE_MBEDTLS) && defined(MBEDTLS_MD4_C)) +#include +#endif +/* The last 3 #include files should be in this order */ +#include "curl_printf.h" #include "curl_memory.h" - -/* The last #include file should be: */ #include "memdebug.h" + +#if defined(USE_WOLFSSL) && !defined(WOLFSSL_NO_MD4) + +#elif defined(USE_OPENSSL) && !defined(OPENSSL_NO_MD4) + +#elif defined(USE_GNUTLS) + typedef struct md4_ctx MD4_CTX; static void MD4_Init(MD4_CTX *ctx) @@ -85,27 +109,7 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx) md4_digest(ctx, MD4_DIGEST_SIZE, result); } -/* When OpenSSL or wolfSSL is available, we use their MD4 functions. */ -#elif defined(USE_WOLFSSL) && !defined(WOLFSSL_NO_MD4) -#include - -#elif defined(USE_OPENSSL) && !defined(OPENSSL_NO_MD4) -#include - -#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \ - (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) && \ - defined(__MAC_OS_X_VERSION_MIN_ALLOWED) && \ - (__MAC_OS_X_VERSION_MIN_ALLOWED < 101500)) || \ - (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \ - (__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000)) - -#include - -#include "curl_memory.h" - -/* The last #include file should be: */ -#include "memdebug.h" - +#elif defined(AN_APPLE_OS) typedef CC_MD4_CTX MD4_CTX; static void MD4_Init(MD4_CTX *ctx) @@ -125,13 +129,6 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx) #elif defined(USE_WIN32_CRYPTO) -#include - -#include "curl_memory.h" - -/* The last #include file should be: */ -#include "memdebug.h" - struct md4_ctx { HCRYPTPROV hCryptProv; HCRYPTHASH hHash; @@ -171,13 +168,6 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx) #elif(defined(USE_MBEDTLS) && defined(MBEDTLS_MD4_C)) -#include - -#include "curl_memory.h" - -/* The last #include file should be: */ -#include "memdebug.h" - struct md4_ctx { void *data; unsigned long size; @@ -255,9 +245,6 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx) * compile-time configuration. */ - -#include - /* Any 32-bit or wider unsigned integer data type will do */ typedef unsigned int MD4_u32plus; diff --git a/lib/md5.c b/lib/md5.c index 5be639929d..9610e0c778 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -26,6 +26,7 @@ #ifndef CURL_DISABLE_CRYPTO_AUTH +#include #include #include "curl_md5.h" @@ -56,12 +57,32 @@ #endif #if defined(USE_GNUTLS) - #include +#elif defined(USE_OPENSSL_MD5) +#include +#elif defined(USE_WOLFSSL_MD5) +#include +#elif defined(USE_MBEDTLS) +#include +#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \ + (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) && \ + defined(__MAC_OS_X_VERSION_MIN_ALLOWED) && \ + (__MAC_OS_X_VERSION_MIN_ALLOWED < 101500)) || \ + (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \ + (__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000)) +#define AN_APPLE_OS +#include +#elif defined(USE_WIN32_CRYPTO) +#include +#endif + +/* The last 3 #include files should be in this order */ +#include "curl_printf.h" #include "curl_memory.h" -/* The last #include file should be: */ #include "memdebug.h" +#if defined(USE_GNUTLS) + typedef struct md5_ctx my_md5_ctx; static CURLcode my_md5_init(my_md5_ctx *ctx) @@ -84,17 +105,6 @@ static void my_md5_final(unsigned char *digest, my_md5_ctx *ctx) #elif defined(USE_OPENSSL_MD5) || defined(USE_WOLFSSL_MD5) -/* When OpenSSL or wolfSSL is available, we use their MD5 functions. */ -#if defined(USE_OPENSSL_MD5) -#include -#elif defined(USE_WOLFSSL_MD5) -#include -#endif - -#include "curl_memory.h" -/* The last #include file should be: */ -#include "memdebug.h" - typedef MD5_CTX my_md5_ctx; static CURLcode my_md5_init(my_md5_ctx *ctx) @@ -119,13 +129,6 @@ static void my_md5_final(unsigned char *digest, my_md5_ctx *ctx) #elif defined(USE_MBEDTLS) -#include - -#include "curl_memory.h" - -/* The last #include file should be: */ -#include "memdebug.h" - typedef mbedtls_md5_context my_md5_ctx; static CURLcode my_md5_init(my_md5_ctx *ctx) @@ -162,12 +165,7 @@ static void my_md5_final(unsigned char *digest, my_md5_ctx *ctx) #endif } -#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \ - (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) && \ - defined(__MAC_OS_X_VERSION_MIN_ALLOWED) && \ - (__MAC_OS_X_VERSION_MIN_ALLOWED < 101500)) || \ - (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \ - (__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000)) +#elif defined(AN_APPLE_OS) /* For Apple operating systems: CommonCrypto has the functions we need. These functions are available on Tiger and later, as well as iOS 2.0 @@ -175,11 +173,7 @@ static void my_md5_final(unsigned char *digest, my_md5_ctx *ctx) Declaring the functions as static like this seems to be a bit more reliable than defining COMMON_DIGEST_FOR_OPENSSL on older cats. */ -# include # define my_md5_ctx CC_MD5_CTX -#include "curl_memory.h" -/* The last #include file should be: */ -#include "memdebug.h" static CURLcode my_md5_init(my_md5_ctx *ctx) { @@ -203,11 +197,6 @@ static void my_md5_final(unsigned char *digest, my_md5_ctx *ctx) #elif defined(USE_WIN32_CRYPTO) -#include -#include "curl_memory.h" -/* The last #include file should be: */ -#include "memdebug.h" - struct md5_ctx { HCRYPTPROV hCryptProv; HCRYPTHASH hHash; @@ -288,12 +277,6 @@ static void my_md5_final(unsigned char *digest, my_md5_ctx *ctx) * compile-time configuration. */ -#include - -/* The last #include files should be: */ -#include "curl_memory.h" -#include "memdebug.h" - /* Any 32-bit or wider unsigned integer data type will do */ typedef unsigned int MD5_u32plus; diff --git a/lib/sha256.c b/lib/sha256.c index 60720f5b13..c96a9fc61f 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -57,18 +57,6 @@ #endif #endif /* USE_MBEDTLS */ -/* Please keep the SSL backend-specific #if branches in this order: - * - * 1. USE_OPENSSL - * 2. USE_GNUTLS - * 3. USE_MBEDTLS - * 4. USE_COMMON_CRYPTO - * 5. USE_WIN32_CRYPTO - * - * This ensures that the same SSL branch gets activated throughout this source - * file even if multiple backends are enabled at the same time. - */ - #if defined(USE_OPENSSL_SHA256) /* When OpenSSL or wolfSSL is available is available we use their @@ -80,11 +68,39 @@ #include #endif -#include "curl_memory.h" +#elif defined(USE_GNUTLS) +#include +#elif defined(USE_MBEDTLS) +#include +#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \ + (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)) || \ + (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \ + (__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000)) +#include +#define AN_APPLE_OS +#elif defined(USE_WIN32_CRYPTO) +#include +#endif -/* The last #include file should be: */ +/* The last 3 #include files should be in this order */ +#include "curl_printf.h" +#include "curl_memory.h" #include "memdebug.h" +/* Please keep the SSL backend-specific #if branches in this order: + * + * 1. USE_OPENSSL + * 2. USE_GNUTLS + * 3. USE_MBEDTLS + * 4. USE_COMMON_CRYPTO + * 5. USE_WIN32_CRYPTO + * + * This ensures that the same SSL branch gets activated throughout this source + * file even if multiple backends are enabled at the same time. + */ + +#if defined(USE_OPENSSL_SHA256) + struct sha256_ctx { EVP_MD_CTX *openssl_ctx; }; @@ -115,13 +131,6 @@ static void my_sha256_final(unsigned char *digest, my_sha256_ctx *ctx) #elif defined(USE_GNUTLS) -#include - -#include "curl_memory.h" - -/* The last #include file should be: */ -#include "memdebug.h" - typedef struct sha256_ctx my_sha256_ctx; static CURLcode my_sha256_init(my_sha256_ctx *ctx) @@ -144,13 +153,6 @@ static void my_sha256_final(unsigned char *digest, my_sha256_ctx *ctx) #elif defined(USE_MBEDTLS) -#include - -#include "curl_memory.h" - -/* The last #include file should be: */ -#include "memdebug.h" - typedef mbedtls_sha256_context my_sha256_ctx; static CURLcode my_sha256_init(my_sha256_ctx *ctx) @@ -183,18 +185,7 @@ static void my_sha256_final(unsigned char *digest, my_sha256_ctx *ctx) #endif } -#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \ - (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)) || \ - (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \ - (__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000)) - -#include - -#include "curl_memory.h" - -/* The last #include file should be: */ -#include "memdebug.h" - +#elif defined(AN_APPLE_OS) typedef CC_SHA256_CTX my_sha256_ctx; static CURLcode my_sha256_init(my_sha256_ctx *ctx) @@ -217,8 +208,6 @@ static void my_sha256_final(unsigned char *digest, my_sha256_ctx *ctx) #elif defined(USE_WIN32_CRYPTO) -#include - struct sha256_ctx { HCRYPTPROV hCryptProv; HCRYPTHASH hHash; diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c index 5a2c0f8bbf..f5632bf11f 100644 --- a/lib/vssh/libssh2.c +++ b/lib/vssh/libssh2.c @@ -83,7 +83,6 @@ #include "select.h" #include "warnless.h" #include "curl_path.h" -#include "strcase.h" #include /* for base64 encoding/decoding */ #include diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c index 12cf618f56..b08808c433 100644 --- a/lib/vtls/nss.c +++ b/lib/vtls/nss.c @@ -68,7 +68,6 @@ #include #endif -#include "strcase.h" #include "warnless.h" #include "x509asn1.h" diff --git a/lib/vtls/schannel.h b/lib/vtls/schannel.h index 24d7eff25b..42cecd9e55 100644 --- a/lib/vtls/schannel.h +++ b/lib/vtls/schannel.h @@ -83,8 +83,6 @@ CURLcode Curl_verify_certificate(struct Curl_easy *data, /* structs to expose only in schannel.c and schannel_verify.c */ #ifdef EXPOSE_SCHANNEL_INTERNAL_STRUCTS -#include - #ifdef __MINGW32__ #ifdef __MINGW64_VERSION_MAJOR #define HAS_MANUAL_VERIFY_API diff --git a/lib/vtls/sectransp.c b/lib/vtls/sectransp.c index c764e3631b..d44f14ba60 100644 --- a/lib/vtls/sectransp.c +++ b/lib/vtls/sectransp.c @@ -122,7 +122,6 @@ #include #endif /* CURL_BUILD_MAC */ -#include "urldata.h" #include "sendf.h" #include "inet_pton.h" #include "connect.h" diff --git a/src/tool_setopt.c b/src/tool_setopt.c index 3db2fe3c68..dae7704cda 100644 --- a/src/tool_setopt.c +++ b/src/tool_setopt.c @@ -710,7 +710,4 @@ CURLcode tool_setopt(CURL *curl, bool str, struct GlobalConfig *global, #else /* CURL_DISABLE_LIBCURL_OPTION */ -#include "tool_cfgable.h" -#include "tool_setopt.h" - #endif /* CURL_DISABLE_LIBCURL_OPTION */ diff --git a/tests/server/mqttd.c b/tests/server/mqttd.c index d653917ef1..028c7658dd 100644 --- a/tests/server/mqttd.c +++ b/tests/server/mqttd.c @@ -62,7 +62,6 @@ #include "curlx.h" /* from the private lib dir */ #include "getpart.h" #include "inet_pton.h" -#include "util.h" #include "server_sockaddr.h" #include "warnless.h"