]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
misc: remove duplicated include files
authorDaniel Stenberg <daniel@haxx.se>
Mon, 24 Oct 2022 21:27:31 +0000 (23:27 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 26 Oct 2022 09:27:59 +0000 (11:27 +0200)
Closes #9796

15 files changed:
lib/asyn-thread.c
lib/easy.c
lib/ftp.c
lib/hsts.c
lib/http_aws_sigv4.c
lib/imap.c
lib/md4.c
lib/md5.c
lib/sha256.c
lib/vssh/libssh2.c
lib/vtls/nss.c
lib/vtls/schannel.h
lib/vtls/sectransp.c
src/tool_setopt.c
tests/server/mqttd.c

index 8b375eb5ee8924217e191964b61e9a6772ee314f..e121c516fee0d159127887552e926e29b10900de 100644 (file)
@@ -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"
index b8ac1ef8a81b0e9efd08479cf75cee0698a8d703..b61ea7b7c529ef287fc3315e49fcc084fe810888 100644 (file)
@@ -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"
index f1a25b23dcfda35e54847d95bb1b453e0984ef6e..082593348bc157ff0d1fe00f5402034e0ba30f5d 100644 (file)
--- 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"
index e3b686ebfa487c0fe1c65cf2b06eb98af1784f5d..330fe37ac5fce998894179ece4622b36a9f2c6fe 100644 (file)
@@ -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"
index 440eb385f89222cc3a337d6aeeed6b45d0869d07..70832c0097c0d471d40b251e321de6ca1b25b3e8 100644 (file)
@@ -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"
 
index ffa08bf7a403c4492fbfb3ecff7474ab4c209f56..9420d00e595dbd794fe88343519851bd1a2c5aca 100644 (file)
@@ -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"
index e976fe7bdc07b69374ff08b4d9c52da3e27bdcb2..c13b080d693a79d18d43ea93e0e4bfb7736668b2 100644 (file)
--- a/lib/md4.c
+++ b/lib/md4.c
 
 #if !defined(CURL_DISABLE_CRYPTO_AUTH)
 
+#include <string.h>
+
 #include "curl_md4.h"
 #include "warnless.h"
 
-
 #ifdef USE_OPENSSL
 #include <openssl/opensslconf.h>
 #if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3) && \
 #else
 #include <mbedtls/config.h>
 #endif
-
 #if(MBEDTLS_VERSION_NUMBER >= 0x02070000)
   #define HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS
 #endif
 #endif /* USE_MBEDTLS */
 
 #if defined(USE_GNUTLS)
-
 #include <nettle/md4.h>
+/* When OpenSSL or wolfSSL is available, we use their MD4 functions. */
+#elif defined(USE_WOLFSSL) && !defined(WOLFSSL_NO_MD4)
+#include <wolfssl/openssl/md4.h>
+#elif defined(USE_OPENSSL) && !defined(OPENSSL_NO_MD4)
+#include <openssl/md4.h>
+#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 <CommonCrypto/CommonDigest.h>
+#elif defined(USE_WIN32_CRYPTO)
+#include <wincrypt.h>
+#elif(defined(USE_MBEDTLS) && defined(MBEDTLS_MD4_C))
+#include <mbedtls/md4.h>
+#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 <wolfssl/openssl/md4.h>
-
-#elif defined(USE_OPENSSL) && !defined(OPENSSL_NO_MD4)
-#include <openssl/md4.h>
-
-#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 <CommonCrypto/CommonDigest.h>
-
-#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 <wincrypt.h>
-
-#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 <mbedtls/md4.h>
-
-#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 <string.h>
-
 /* Any 32-bit or wider unsigned integer data type will do */
 typedef unsigned int MD4_u32plus;
 
index 5be639929d7081b6c6a8657e3b7e90ff4c8b8270..9610e0c778707cde681f9ff672f083644dcfbd77 100644 (file)
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -26,6 +26,7 @@
 
 #ifndef CURL_DISABLE_CRYPTO_AUTH
 
+#include <string.h>
 #include <curl/curl.h>
 
 #include "curl_md5.h"
 #endif
 
 #if defined(USE_GNUTLS)
-
 #include <nettle/md5.h>
+#elif defined(USE_OPENSSL_MD5)
+#include <openssl/md5.h>
+#elif defined(USE_WOLFSSL_MD5)
+#include <wolfssl/openssl/md5.h>
+#elif defined(USE_MBEDTLS)
+#include <mbedtls/md5.h>
+#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 <CommonCrypto/CommonDigest.h>
+#elif defined(USE_WIN32_CRYPTO)
+#include <wincrypt.h>
+#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 <openssl/md5.h>
-#elif defined(USE_WOLFSSL_MD5)
-#include <wolfssl/openssl/md5.h>
-#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 <mbedtls/md5.h>
-
-#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 <CommonCrypto/CommonDigest.h>
 #  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 <wincrypt.h>
-#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 <string.h>
-
-/* 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;
 
index 60720f5b138d254b19e771f0347e3a1744c3a26c..c96a9fc61feabd94baee02e70df6f9fef6086240 100644 (file)
 #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
 #include <wolfssl/openssl/evp.h>
 #endif
 
-#include "curl_memory.h"
+#elif defined(USE_GNUTLS)
+#include <nettle/sha.h>
+#elif defined(USE_MBEDTLS)
+#include <mbedtls/sha256.h>
+#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 <CommonCrypto/CommonDigest.h>
+#define AN_APPLE_OS
+#elif defined(USE_WIN32_CRYPTO)
+#include <wincrypt.h>
+#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 <nettle/sha.h>
-
-#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 <mbedtls/sha256.h>
-
-#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 <CommonCrypto/CommonDigest.h>
-
-#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 <wincrypt.h>
-
 struct sha256_ctx {
   HCRYPTPROV hCryptProv;
   HCRYPTHASH hHash;
index 5a2c0f8bbfdd0742ce20f1763578263d2b7a8cb7..f5632bf11f24069b7c883f0ef74ae6e00d403ad3 100644 (file)
@@ -83,7 +83,6 @@
 #include "select.h"
 #include "warnless.h"
 #include "curl_path.h"
-#include "strcase.h"
 
 #include <curl_base64.h> /* for base64 encoding/decoding */
 #include <curl_sha256.h>
index 12cf618f561700053d6076c8bd4afa153276922f..b08808c433695d2f4dfb0fda9455c3bfd664d891 100644 (file)
@@ -68,7 +68,6 @@
 #include <ocsp.h>
 #endif
 
-#include "strcase.h"
 #include "warnless.h"
 #include "x509asn1.h"
 
index 24d7eff25b9b0ed46257d63668c76698e74680b7..42cecd9e55fd4523e7a9b7929e21162b439caf2c 100644 (file)
@@ -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 <wincrypt.h>
-
 #ifdef __MINGW32__
 #ifdef __MINGW64_VERSION_MAJOR
 #define HAS_MANUAL_VERIFY_API
index c764e3631b5614fd407010633aeb42b98e65275f..d44f14ba60c2af14b73e2044f6e25370f518fd16 100644 (file)
 #include <sys/sysctl.h>
 #endif /* CURL_BUILD_MAC */
 
-#include "urldata.h"
 #include "sendf.h"
 #include "inet_pton.h"
 #include "connect.h"
index 3db2fe3c68d8611fd4b8b223d2111b8e4e0f48cd..dae7704cda573c733b53c7c3f4afd14f3b5dd37b 100644 (file)
@@ -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 */
index d653917ef1833c584b28443f6ccd85a5db153ed8..028c7658dd62a21bc6ff569977fbae79c3beb90f 100644 (file)
@@ -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"