1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 15:48:49 -05:00

curl_memory: make curl_memory.h the second-last header file loaded

This header file must be included after all header files except
memdebug.h, as it does similar memory function redefinitions and can be
similarly affected by conflicting definitions in system or dependent
library headers.
This commit is contained in:
Dan Fandrich 2015-03-24 23:12:03 +01:00
parent ac2827ac09
commit 35648f2e79
40 changed files with 102 additions and 81 deletions

View File

@ -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 --- */

View File

@ -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__

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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 */

View File

@ -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

View File

@ -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 */

View File

@ -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"
/*

View File

@ -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"
/*

View File

@ -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 */

View File

@ -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

View File

@ -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

View File

@ -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__) || \

View File

@ -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

View File

@ -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"
/*

View File

@ -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"
/*

View File

@ -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)

View File

@ -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"
/*

View File

@ -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:

View File

@ -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,

View File

@ -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,

View File

@ -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)

View File

@ -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

View File

@ -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. */

View File

@ -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 */

View File

@ -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

View File

@ -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"
/*

View File

@ -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

View File

@ -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 */

View File

@ -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 */

View File

@ -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

View File

@ -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 */

View File

@ -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"
/*

View File

@ -40,11 +40,12 @@
#include "connect.h" /* for the connect timeout */
#include "select.h"
#include "curl_printf.h"
#include "curl_memory.h"
#include <unistd.h>
/* The last #include file should be: */
#include "memdebug.h"
#include "hostcheck.h"
#include <unistd.h>
/* The last #include files should be: */
#include "curl_memory.h"
#include "memdebug.h"
/* Global axTLS init, called from Curl_ssl_init() */

View File

@ -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;

View File

@ -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"

View File

@ -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

View File

@ -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 */