diff options
Diffstat (limited to 'lib')
40 files changed, 101 insertions, 80 deletions
diff --git a/lib/base64.c b/lib/base64.c index 1defca19e..6b87eed40 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -27,10 +27,10 @@ #include "urldata.h" /* for the SessionHandle definition */ #include "warnless.h" #include "curl_base64.h" -#include "curl_memory.h" #include "non-ascii.h" -/* include memdebug.h last */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* ---- Base64 Encoding/Decoding Table --- */ diff --git a/lib/connect.c b/lib/connect.c index 68317d986..1781e4b52 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -62,7 +62,6 @@ #include "if2ip.h" #include "strerror.h" #include "connect.h" -#include "curl_memory.h" #include "select.h" #include "url.h" /* for Curl_safefree() */ #include "multiif.h" @@ -75,7 +74,8 @@ #include "conncache.h" #include "multihandle.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" #ifdef __SYMBIAN32__ diff --git a/lib/cookie.c b/lib/cookie.c index ddf6f72b1..f1450e905 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -91,14 +91,14 @@ Example set of cookies: #include "strtok.h" #include "sendf.h" #include "slist.h" -#include "curl_memory.h" #include "share.h" #include "strtoofft.h" #include "rawstr.h" #include "curl_memrchr.h" #include "inet_pton.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" static void freecookie(struct Cookie *co) diff --git a/lib/curl_memory.h b/lib/curl_memory.h index e3cdc721c..bc744ccd8 100644 --- a/lib/curl_memory.h +++ b/lib/curl_memory.h @@ -28,6 +28,9 @@ * File curl_memory.h must be included by _all_ *.c source files * that use memory related functions strdup, malloc, calloc, realloc * or free, and given source file is used to build libcurl library. + * It should be included immediately before memdebug.h as the last files + * included to avoid undesired interaction with other memory function + * headers in dependent libraries. * * There is nearly no exception to above rule. All libcurl source * files in 'lib' subdirectory as well as those living deep inside diff --git a/lib/curl_ntlm.c b/lib/curl_ntlm.c index 1bc509d7e..1f3bdccdf 100644 --- a/lib/curl_ntlm.c +++ b/lib/curl_ntlm.c @@ -41,7 +41,6 @@ #include "curl_ntlm_wb.h" #include "curl_sasl.h" #include "url.h" -#include "curl_memory.h" #include "curl_printf.h" #if defined(USE_NSS) @@ -50,7 +49,8 @@ #include "curl_sspi.h" #endif -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" #if DEBUG_ME diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c index a77f42da0..2e5b573fd 100644 --- a/lib/curl_ntlm_core.c +++ b/lib/curl_ntlm_core.c @@ -101,7 +101,6 @@ #include "urldata.h" #include "non-ascii.h" #include "rawstr.h" -#include "curl_memory.h" #include "curl_ntlm_core.h" #include "curl_md5.h" #include "curl_hmac.h" @@ -110,7 +109,8 @@ #include "curl_des.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" #define NTLM_HMAC_MD5_LEN (16) diff --git a/lib/curl_ntlm_msgs.c b/lib/curl_ntlm_msgs.c index 3161b3888..b5f3935d8 100644 --- a/lib/curl_ntlm_msgs.c +++ b/lib/curl_ntlm_msgs.c @@ -41,7 +41,6 @@ #include "curl_gethostname.h" #include "curl_multibyte.h" #include "warnless.h" -#include "curl_memory.h" #include "vtls/vtls.h" @@ -55,7 +54,8 @@ #include "curl_endian.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* "NTLMSSP" signature is always in ASCII regardless of the platform */ diff --git a/lib/curl_ntlm_wb.c b/lib/curl_ntlm_wb.c index 53681a0d5..d63fb277b 100644 --- a/lib/curl_ntlm_wb.c +++ b/lib/curl_ntlm_wb.c @@ -51,10 +51,10 @@ #include "curl_ntlm_wb.h" #include "url.h" #include "strerror.h" -#include "curl_memory.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" #if DEBUG_ME diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c index f192fddac..d9f63ab0b 100644 --- a/lib/curl_sasl.c +++ b/lib/curl_sasl.c @@ -39,7 +39,6 @@ #include "curl_hmac.h" #include "curl_sasl.h" #include "warnless.h" -#include "curl_memory.h" #include "strtok.h" #include "strequal.h" #include "rawstr.h" @@ -47,7 +46,8 @@ #include "non-ascii.h" /* included for Curl_convert_... prototypes */ #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* Supported mechanisms */ diff --git a/lib/curl_sasl_gssapi.c b/lib/curl_sasl_gssapi.c index 81d241bb0..3c6f3ce32 100644 --- a/lib/curl_sasl_gssapi.c +++ b/lib/curl_sasl_gssapi.c @@ -33,11 +33,11 @@ #include "urldata.h" #include "curl_base64.h" #include "curl_gssapi.h" -#include "curl_memory.h" #include "sendf.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* diff --git a/lib/curl_sasl_sspi.c b/lib/curl_sasl_sspi.c index 238d74b7e..0a332e60b 100644 --- a/lib/curl_sasl_sspi.c +++ b/lib/curl_sasl_sspi.c @@ -36,13 +36,13 @@ #include "urldata.h" #include "curl_base64.h" #include "warnless.h" -#include "curl_memory.h" #include "curl_multibyte.h" #include "sendf.h" #include "strdup.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* diff --git a/lib/curl_sspi.c b/lib/curl_sspi.c index 401c5b408..43fcb637d 100644 --- a/lib/curl_sspi.c +++ b/lib/curl_sspi.c @@ -26,11 +26,11 @@ #include <curl/curl.h> #include "curl_sspi.h" -#include "curl_memory.h" #include "curl_multibyte.h" #include "warnless.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* We use our own typedef here since some headers might lack these */ diff --git a/lib/easy.c b/lib/easy.c index f094fc099..316acb1d1 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -60,7 +60,6 @@ #include "hostip.h" #include "share.h" #include "strdup.h" -#include "curl_memory.h" #include "progress.h" #include "easyif.h" #include "select.h" @@ -77,7 +76,8 @@ #include "ssh.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* win32_cleanup() is for win32 socket cleanup functionality, the opposite diff --git a/lib/escape.c b/lib/escape.c index 814e5b72f..24abb930b 100644 --- a/lib/escape.c +++ b/lib/escape.c @@ -27,14 +27,14 @@ #include <curl/curl.h> -#include "curl_memory.h" #include "urldata.h" #include "warnless.h" #include "non-ascii.h" #include "escape.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* Portable character check (remember EBCDIC). Do not use isalnum() because diff --git a/lib/file.c b/lib/file.c index 14e765f5e..324d4e290 100644 --- a/lib/file.c +++ b/lib/file.c @@ -59,12 +59,12 @@ #include "getinfo.h" #include "transfer.h" #include "url.h" -#include "curl_memory.h" #include "parsedate.h" /* for the week day and month names */ #include "warnless.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" #if defined(WIN32) || defined(MSDOS) || defined(__EMX__) || \ diff --git a/lib/formdata.c b/lib/formdata.c index 7299aa123..cd98f3c6f 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -34,12 +34,12 @@ #include "formdata.h" #include "vtls/vtls.h" #include "strequal.h" -#include "curl_memory.h" #include "sendf.h" #include "strdup.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" #ifndef HAVE_BASENAME diff --git a/lib/getinfo.c b/lib/getinfo.c index 9ece7760c..910f520ed 100644 --- a/lib/getinfo.c +++ b/lib/getinfo.c @@ -27,12 +27,12 @@ #include "urldata.h" #include "getinfo.h" -#include "curl_memory.h" #include "vtls/vtls.h" #include "connect.h" /* Curl_getconnectinfo() */ #include "progress.h" -/* Make this the last #include */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* diff --git a/lib/http.c b/lib/http.c index c79526ee0..efd6b524b 100644 --- a/lib/http.c +++ b/lib/http.c @@ -63,7 +63,6 @@ #include "share.h" #include "hostip.h" #include "http.h" -#include "curl_memory.h" #include "select.h" #include "parsedate.h" /* for the week day and month names */ #include "strtoofft.h" @@ -79,7 +78,8 @@ #include "connect.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* diff --git a/lib/http2.c b/lib/http2.c index f6dbd8069..658d6141e 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -30,11 +30,11 @@ #include "http.h" #include "sendf.h" #include "curl_base64.h" -#include "curl_memory.h" #include "rawstr.h" #include "multiif.h" -/* include memdebug.h last */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" #if (NGHTTP2_VERSION_NUM < 0x000600) diff --git a/lib/http_chunks.c b/lib/http_chunks.c index 0b1a5ed37..80c0f9548 100644 --- a/lib/http_chunks.c +++ b/lib/http_chunks.c @@ -29,12 +29,12 @@ #include "content_encoding.h" #include "http.h" -#include "curl_memory.h" #include "non-ascii.h" /* for Curl_convert_to_network prototype */ #include "strtoofft.h" #include "warnless.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* diff --git a/lib/http_digest.c b/lib/http_digest.c index 33d79ab5a..929e2c60f 100644 --- a/lib/http_digest.c +++ b/lib/http_digest.c @@ -28,10 +28,10 @@ #include "rawstr.h" #include "curl_sasl.h" #include "http_digest.h" -#include "curl_memory.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* Test example headers: diff --git a/lib/http_negotiate.c b/lib/http_negotiate.c index 1c840fe03..21658cf7a 100644 --- a/lib/http_negotiate.c +++ b/lib/http_negotiate.c @@ -30,12 +30,12 @@ #include "rawstr.h" #include "curl_base64.h" #include "http_negotiate.h" -#include "curl_memory.h" #include "curl_sasl.h" #include "url.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy, diff --git a/lib/http_negotiate_sspi.c b/lib/http_negotiate_sspi.c index d3c028c17..20f8d643c 100644 --- a/lib/http_negotiate_sspi.c +++ b/lib/http_negotiate_sspi.c @@ -33,11 +33,11 @@ #include "curl_base64.h" #include "curl_sasl.h" #include "http_negotiate.h" -#include "curl_memory.h" #include "curl_multibyte.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy, diff --git a/lib/krb5.c b/lib/krb5.c index 60bc6a5e9..ad7dd67af 100644 --- a/lib/krb5.c +++ b/lib/krb5.c @@ -46,11 +46,11 @@ #include "curl_gssapi.h" #include "sendf.h" #include "curl_sec.h" -#include "curl_memory.h" #include "warnless.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" #define LOCAL_ADDR (&conn->local_addr) diff --git a/lib/ldap.c b/lib/ldap.c index 9e71185d4..4d9128226 100644 --- a/lib/ldap.c +++ b/lib/ldap.c @@ -72,12 +72,14 @@ #include "strequal.h" #include "strtok.h" #include "curl_ldap.h" -#include "curl_memory.h" #include "curl_multibyte.h" #include "curl_base64.h" #include "rawstr.h" #include "connect.h" #include "curl_printf.h" + +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" #ifndef HAVE_LDAP_URL_PARSE @@ -28,11 +28,10 @@ #include "curl_hmac.h" #include "warnless.h" -#include "curl_memory.h" - #if defined(USE_GNUTLS_NETTLE) #include <nettle/md5.h> +#include "curl_memory.h" /* The last #include file should be: */ #include "memdebug.h" @@ -58,6 +57,7 @@ static void MD5_Final(unsigned char digest[16], MD5_CTX * ctx) #elif defined(USE_GNUTLS) #include <gcrypt.h> +#include "curl_memory.h" /* The last #include file should be: */ #include "memdebug.h" @@ -84,6 +84,9 @@ static void MD5_Final(unsigned char digest[16], MD5_CTX * ctx) #elif defined(USE_OPENSSL) /* When OpenSSL is available we use the MD5-function from OpenSSL */ #include <openssl/md5.h> +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" #elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \ (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)) || \ @@ -98,6 +101,9 @@ static void MD5_Final(unsigned char digest[16], MD5_CTX * ctx) reliable than defining COMMON_DIGEST_FOR_OPENSSL on older cats. */ # include <CommonCrypto/CommonDigest.h> # define MD5_CTX CC_MD5_CTX +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" static void MD5_Init(MD5_CTX *ctx) { @@ -119,6 +125,9 @@ static void MD5_Final(unsigned char digest[16], MD5_CTX *ctx) #elif defined(_WIN32) #include <wincrypt.h> +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" typedef struct { HCRYPTPROV hCryptProv; @@ -156,6 +165,9 @@ static void MD5_Final(unsigned char digest[16], MD5_CTX *ctx) #include <axTLS/config.h> #include <axTLS/os_int.h> #include <axTLS/crypto.h> +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" #else /* When no other crypto library is available we use this code segment */ /* @@ -197,6 +209,10 @@ static void MD5_Final(unsigned char digest[16], MD5_CTX *ctx) #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; @@ -465,9 +481,6 @@ static void MD5_Final(unsigned char *result, MD5_CTX *ctx) #endif /* CRYPTO LIBS */ -/* The last #include file should be: */ -#include "memdebug.h" - const HMAC_params Curl_HMAC_MD5[] = { { (HMAC_hinit_func) MD5_Init, /* Hash initialization function. */ diff --git a/lib/netrc.c b/lib/netrc.c index dbe79d3dd..6271a3a2f 100644 --- a/lib/netrc.c +++ b/lib/netrc.c @@ -31,11 +31,11 @@ #include "strequal.h" #include "strtok.h" -#include "curl_memory.h" #include "rawstr.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* Get user and password from .netrc when given a machine name */ diff --git a/lib/openldap.c b/lib/openldap.c index 40ad25560..bee552f33 100644 --- a/lib/openldap.c +++ b/lib/openldap.c @@ -44,10 +44,12 @@ #include "vtls/vtls.h" #include "transfer.h" #include "curl_ldap.h" -#include "curl_memory.h" #include "curl_base64.h" #include "connect.h" #include "curl_printf.h" + +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" #ifndef _LDAP_PVT_H diff --git a/lib/rtsp.c b/lib/rtsp.c index a1d1862d6..b133e205f 100644 --- a/lib/rtsp.c +++ b/lib/rtsp.c @@ -34,12 +34,12 @@ #include "progress.h" #include "rtsp.h" #include "rawstr.h" -#include "curl_memory.h" #include "select.h" #include "connect.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* diff --git a/lib/sendf.c b/lib/sendf.c index 96899f466..879e08292 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -32,10 +32,10 @@ #include "multiif.h" #include "non-ascii.h" #include "curl_printf.h" -#include "curl_memory.h" #include "strerror.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" #ifdef CURL_DO_LINEEND_CONV diff --git a/lib/slist.c b/lib/slist.c index 3cac6ca21..9c0b2a58a 100644 --- a/lib/slist.c +++ b/lib/slist.c @@ -22,10 +22,10 @@ #include "curl_setup.h" -#include "curl_memory.h" #include "slist.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* returns last node in linked list */ @@ -44,11 +44,11 @@ #include "transfer.h" #include "vtls/vtls.h" #include "curl_ntlm_core.h" -#include "curl_memory.h" #include "escape.h" #include "curl_endian.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* Local API functions */ diff --git a/lib/telnet.c b/lib/telnet.c index fa2f65723..91863c065 100644 --- a/lib/telnet.c +++ b/lib/telnet.c @@ -57,13 +57,13 @@ #define TELCMDS #include "arpa_telnet.h" -#include "curl_memory.h" #include "select.h" #include "strequal.h" #include "rawstr.h" #include "warnless.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" #define SUBBUFSIZE 512 diff --git a/lib/tftp.c b/lib/tftp.c index 56dabc6df..4c5796f55 100644 --- a/lib/tftp.c +++ b/lib/tftp.c @@ -58,10 +58,10 @@ #include "rawstr.h" #include "speedcheck.h" #include "curl_printf.h" -#include "curl_memory.h" #include "select.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* RFC2348 allows the block size to be negotiated */ diff --git a/lib/transfer.c b/lib/transfer.c index c7938c030..ed358dca9 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -75,14 +75,14 @@ #include "curl_ntlm.h" #include "http_negotiate.h" #include "share.h" -#include "curl_memory.h" #include "select.h" #include "multiif.h" #include "connect.h" #include "non-ascii.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* diff --git a/lib/vtls/axtls.c b/lib/vtls/axtls.c index 930136a23..08db9c568 100644 --- a/lib/vtls/axtls.c +++ b/lib/vtls/axtls.c @@ -40,11 +40,12 @@ #include "connect.h" /* for the connect timeout */ #include "select.h" #include "curl_printf.h" -#include "curl_memory.h" +#include "hostcheck.h" #include <unistd.h> -/* The last #include file should be: */ + +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" -#include "hostcheck.h" /* Global axTLS init, called from Curl_ssl_init() */ diff --git a/lib/vtls/cyassl.c b/lib/vtls/cyassl.c index 00f2a05cb..d400b3f2c 100644 --- a/lib/vtls/cyassl.c +++ b/lib/vtls/cyassl.c @@ -44,7 +44,6 @@ #include "select.h" #include "rawstr.h" #include "curl_printf.h" -#include "curl_memory.h" #include <cyassl/ssl.h> #include <cyassl/version.h> @@ -55,7 +54,8 @@ #endif #include <cyassl/ctaocrypt/random.h> -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" static Curl_recv cyassl_recv; diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c index ec807c5c2..feb00ca81 100644 --- a/lib/vtls/nss.c +++ b/lib/vtls/nss.c @@ -63,12 +63,12 @@ #include <ocsp.h> #endif -#include "curl_memory.h" #include "rawstr.h" #include "warnless.h" #include "x509asn1.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" #define SSL_DIR "/etc/pki/nssdb" diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 56b5ff112..7a5a7dc30 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -73,10 +73,10 @@ #endif #include "warnless.h" -#include "curl_memory.h" #include "non-ascii.h" /* for Curl_convert_from_utf8 prototype */ -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" #ifndef OPENSSL_VERSION_NUMBER diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index 4980d674f..6973de42a 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -63,7 +63,6 @@ #include "sendf.h" #include "rawstr.h" #include "url.h" -#include "curl_memory.h" #include "progress.h" #include "share.h" #include "timeval.h" @@ -72,7 +71,8 @@ #include "curl_base64.h" #include "curl_printf.h" -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" /* convenience macro to check if this handle is using a shared SSL session */ |