cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: issue #33 in TODO-RELEASE

From: Seshubabu Pasam <pasam_at_seshubabu.com>
Date: Mon, 10 May 2004 23:23:43 -0700

Daniel,

Here is the memory callback path and the man page for the
curl_global_init_mem function. I was able to build the libraries
(regular and debug.) I couldn't run all the tests (regular and debug)
since something seems to be wrong with my valgrind installation. Let me
know?

Regards
-Seshubabu Pasam

Seshubabu Pasam wrote:
>
>> BTW, since replacing memory functions within the library needs to be
>> done very
>> carefully at a very early stage to not risk having mixed calls, what
>> would you
>> say about we adding the function curl_global_init_mem() that works
>> exactly
>> like curl_global_init() but also allows the memory function callbacks
>> to be
>> set? I think it would properly prevent users from trying to set them
>> at later
>> time and thus cause havok.
>
>
> That sounds like a good idea. Let me do this stuff, test it and I will
> post the patch ASAP.
>
> -Regards
> Seshubabu Pasam
>

Index: docs/libcurl/curl_global_init.3
===================================================================
RCS file: /repository/curl/docs/libcurl/curl_global_init.3,v
retrieving revision 1.2
diff -u -H -r1.2 curl_global_init.3
--- docs/libcurl/curl_global_init.3 27 Feb 2004 15:34:06 -0000 1.2
+++ docs/libcurl/curl_global_init.3 11 May 2004 06:10:01 -0000
@@ -42,6 +42,7 @@
 If this function returns non-zero, something went wrong and you cannot use the
 other curl functions.
 .SH "SEE ALSO"
+.BR curl_global_init_mem "(3), "
 .BR curl_global_cleanup "(3), "
 
 
Index: include/curl/curl.h
===================================================================
RCS file: /repository/curl/include/curl/curl.h,v
retrieving revision 1.251
diff -u -H -r1.251 curl.h
--- include/curl/curl.h 4 May 2004 08:24:13 -0000 1.251
+++ include/curl/curl.h 11 May 2004 06:10:03 -0000
@@ -229,7 +229,7 @@
   CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */
   CURLE_UNKNOWN_TELNET_OPTION, /* 48 - User specified an unknown option */
   CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */
- CURLE_OBSOLETE, /* 50 - NOT USED */
+ CURLE_OBSOLETE, /* 50 - NOT USED */
   CURLE_SSL_PEER_CERTIFICATE, /* 51 - peer's certificate wasn't ok */
   CURLE_GOT_NOTHING, /* 52 - when this is a specific error */
   CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */
@@ -896,8 +896,8 @@
 
 /* structure to be used as parameter for CURLFORM_ARRAY */
 struct curl_forms {
- CURLformoption option;
- const char *value;
+ CURLformoption option;
+ const char *value;
 };
 
 /* use this for multipart formpost building */
@@ -930,6 +930,18 @@
 } CURLFORMcode;
 
 /*
+ * The following typedef's are signatures of malloc, free, realloc, strdup and
+ * calloc respectively. Function pointers of these types can be passed to
+ * curl_set_memory_callbacks function to set user defined memory management
+ * callback routines.
+ */
+typedef void *( *curlMallocFunc ) ( size_t size );
+typedef void ( *curlFreeFunc ) ( void *ptr );
+typedef void *( *curlReallocFunc ) ( void *ptr, size_t size );
+typedef char *( *curlStrdupFunc ) ( const char *str );
+typedef void *( *curlCallocFunc ) ( size_t nmemb, size_t size );
+
+/*
  * NAME curl_formadd()
  *
  * DESCRIPTION
@@ -1007,12 +1019,28 @@
  *
  * DESCRIPTION
  *
- * curl_global_init() should be invoked exactly once for each application that
- * uses libcurl
+ * curl_global_init() or curl_global_init_mem() should be invoked exactly once
+ * for each application that uses libcurl.
  */
 CURLcode curl_global_init(long flags);
 
 /*
+ * NAME curl_global_init_mem()
+ *
+ * DESCRIPTION
+ *
+ * curl_global_init() or curl_global_init_mem() should be invoked exactly once
+ * for each application that uses libcurl. This function can be used to
+ * initialize the libCurl library and set user defined memory management
+ * callback functions. Users can implement memory management routines to check
+ * for memory leaks, check for mis-use of the curl library etc. User registered
+ * callback routines with be invoked by this library instead of the system
+ * memory management routines like malloc, free etc.
+ */
+CURLcode curl_global_init_mem(long flags, curlMallocFunc m, curlFreeFunc f,
+ curlReallocFunc r, curlStrdupFunc s, curlCallocFunc c);
+
+/*
  * NAME curl_global_cleanup()
  *
  * DESCRIPTION
Index: lib/amigaos.c
===================================================================
RCS file: /repository/curl/lib/amigaos.c,v
retrieving revision 1.2
diff -u -H -r1.2 amigaos.c
--- lib/amigaos.c 7 Jan 2004 09:19:35 -0000 1.2
+++ lib/amigaos.c 11 May 2004 06:10:03 -0000
@@ -23,6 +23,7 @@
 
 #include "amigaos.h"
 #include <stdio.h> /* for stderr */
+#include "memdebug.h"
 
 struct Library *SocketBase = NULL;
 
Index: lib/base64.c
===================================================================
RCS file: /repository/curl/lib/base64.c,v
retrieving revision 1.28
diff -u -H -r1.28 base64.c
--- lib/base64.c 1 Mar 2004 12:54:59 -0000 1.28
+++ lib/base64.c 11 May 2004 06:10:03 -0000
@@ -39,12 +39,8 @@
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
-
 #include "base64.h"
-
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 static void decodeQuantum(unsigned char *dest, const char *src)
 {
Index: lib/connect.c
===================================================================
RCS file: /repository/curl/lib/connect.c,v
retrieving revision 1.99
diff -u -H -r1.99 connect.c
--- lib/connect.c 27 Apr 2004 13:56:23 -0000 1.99
+++ lib/connect.c 11 May 2004 06:10:04 -0000
@@ -96,11 +96,7 @@
 #include "if2ip.h"
 #include "strerror.h"
 #include "connect.h"
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 static bool verifyconnect(curl_socket_t sockfd);
 
Index: lib/content_encoding.c
===================================================================
RCS file: /repository/curl/lib/content_encoding.c,v
retrieving revision 1.14
diff -u -H -r1.14 content_encoding.c
--- lib/content_encoding.c 26 Apr 2004 14:02:01 -0000 1.14
+++ lib/content_encoding.c 11 May 2004 06:10:05 -0000
@@ -32,6 +32,7 @@
 #include <curl/curl.h>
 #include "sendf.h"
 #include "content_encoding.h"
+#include "memdebug.h"
 
 #define DSIZ 0x10000 /* buffer size for decompressed data */
 
Index: lib/cookie.c
===================================================================
RCS file: /repository/curl/lib/cookie.c,v
retrieving revision 1.53
diff -u -H -r1.53 cookie.c
--- lib/cookie.c 10 May 2004 14:04:06 -0000 1.53
+++ lib/cookie.c 11 May 2004 06:10:12 -0000
@@ -92,11 +92,7 @@
 #include "strequal.h"
 #include "strtok.h"
 #include "sendf.h"
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 static void
 free_cookiemess(struct Cookie *co)
Index: lib/dict.c
===================================================================
RCS file: /repository/curl/lib/dict.c,v
retrieving revision 1.34
diff -u -H -r1.34 dict.c
--- lib/dict.c 9 Mar 2004 22:52:50 -0000 1.34
+++ lib/dict.c 11 May 2004 06:10:12 -0000
@@ -64,7 +64,6 @@
 #include <sys/select.h>
 #endif
 
-
 #endif
 
 #include "urldata.h"
@@ -78,6 +77,7 @@
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
+#include "memdebug.h"
 
 CURLcode Curl_dict(struct connectdata *conn)
 {
Index: lib/easy.c
===================================================================
RCS file: /repository/curl/lib/easy.c,v
retrieving revision 1.53
diff -u -H -r1.53 easy.c
--- lib/easy.c 29 Apr 2004 10:58:22 -0000 1.53
+++ lib/easy.c 11 May 2004 06:10:13 -0000
@@ -79,11 +79,7 @@
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
 /* win32_cleanup() is for win32 socket cleanup functionality, the opposite
@@ -195,6 +191,45 @@
   return CURLE_OK;
 }
 
+/* The callback functions are defined in memdebug.c */
+extern curlStrdupFunc curl_cstrdup;
+extern curlMallocFunc curl_cmalloc;
+extern curlCallocFunc curl_ccalloc;
+extern curlReallocFunc curl_crealloc;
+extern curlFreeFunc curl_cfree;
+
+/**
+ * curl_global_init_mem globally initializes cURL and also registers the user
+ * provided callback routines.
+ */
+CURLcode curl_global_init_mem(long flags, curlMallocFunc m, curlFreeFunc f,
+ curlReallocFunc r, curlStrdupFunc s, curlCallocFunc c)
+{
+ CURLcode code = CURLE_OK;
+
+ /* Invalid input, return immediately */
+ if ( m == NULL || f == NULL || r == NULL || s == NULL || c == NULL ) {
+ return CURLE_FAILED_INIT;
+ }
+
+ /* Already initialized, don't do it again */
+ if ( initialized )
+ return CURLE_OK;
+
+ /* Call the above method */
+ code = curl_global_init(flags);
+ if ( code == CURLE_OK )
+ {
+ curl_cmalloc = m;
+ curl_cfree = f;
+ curl_cstrdup = s;
+ curl_crealloc = r;
+ curl_ccalloc = c;
+ }
+
+ return code;
+}
+
 /**
  * curl_global_cleanup() globally cleanups cURL, uses the value of
  * "init_flags" to determine what needs to be cleaned up and what doesn't.
Index: lib/escape.c
===================================================================
RCS file: /repository/curl/lib/escape.c,v
retrieving revision 1.30
diff -u -H -r1.30 escape.c
--- lib/escape.c 8 Mar 2004 08:38:29 -0000 1.30
+++ lib/escape.c 11 May 2004 06:10:13 -0000
@@ -32,10 +32,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 char *curl_escape(const char *string, int length)
 {
Index: lib/file.c
===================================================================
RCS file: /repository/curl/lib/file.c,v
retrieving revision 1.54
diff -u -H -r1.54 file.c
--- lib/file.c 26 Apr 2004 07:11:39 -0000 1.54
+++ lib/file.c 11 May 2004 06:10:13 -0000
@@ -88,11 +88,7 @@
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 /*
  * Curl_file_connect() gets called from Curl_protocol_connect() to allow us to
Index: lib/formdata.c
===================================================================
RCS file: /repository/curl/lib/formdata.c,v
retrieving revision 1.62
diff -u -H -r1.62 formdata.c
--- lib/formdata.c 10 May 2004 07:11:52 -0000 1.62
+++ lib/formdata.c 11 May 2004 06:10:15 -0000
@@ -112,13 +112,8 @@
 
 #include <curl/curl.h>
 #include "formdata.h"
-
 #include "strequal.h"
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 /* Length of the random boundary string. */
 #define BOUNDARY_LENGTH 40
Index: lib/ftp.c
===================================================================
RCS file: /repository/curl/lib/ftp.c,v
retrieving revision 1.253
diff -u -H -r1.253 ftp.c
--- lib/ftp.c 27 Apr 2004 13:56:23 -0000 1.253
+++ lib/ftp.c 11 May 2004 06:10:18 -0000
@@ -99,11 +99,7 @@
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 #ifdef HAVE_NI_WITHSCOPEID
 #define NIFLAGS NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID
Index: lib/getenv.c
===================================================================
RCS file: /repository/curl/lib/getenv.c,v
retrieving revision 1.23
diff -u -H -r1.23 getenv.c
--- lib/getenv.c 29 Jan 2004 13:56:45 -0000 1.23
+++ lib/getenv.c 11 May 2004 06:10:18 -0000
@@ -36,10 +36,7 @@
 #endif
 
 #include <curl/curl.h>
-
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 static
 char *GetEnv(const char *variable)
Index: lib/getinfo.c
===================================================================
RCS file: /repository/curl/lib/getinfo.c,v
retrieving revision 1.36
diff -u -H -r1.36 getinfo.c
--- lib/getinfo.c 11 Mar 2004 21:51:55 -0000 1.36
+++ lib/getinfo.c 11 May 2004 06:10:18 -0000
@@ -36,12 +36,7 @@
 #include <stdlib.h>
 #endif
 
-/* Make this the last #include */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#else
-#include <stdlib.h>
-#endif
 
 /*
  * This is supposed to be called in the beginning of a permform() session
Index: lib/hash.c
===================================================================
RCS file: /repository/curl/lib/hash.c,v
retrieving revision 1.23
diff -u -H -r1.23 hash.c
--- lib/hash.c 10 May 2004 09:17:50 -0000 1.23
+++ lib/hash.c 11 May 2004 06:10:19 -0000
@@ -28,12 +28,7 @@
 
 #include "hash.h"
 #include "llist.h"
-
-#ifdef CURLDEBUG
-/* this must be the last include file */
 #include "memdebug.h"
-#endif
-
 
 static unsigned long
 hash_str(const char *key, size_t key_length)
Index: lib/hostares.c
===================================================================
RCS file: /repository/curl/lib/hostares.c,v
retrieving revision 1.6
diff -u -H -r1.6 hostares.c
--- lib/hostares.c 7 May 2004 18:56:33 -0000 1.6
+++ lib/hostares.c 11 May 2004 06:10:19 -0000
@@ -86,11 +86,7 @@
 #if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
 #include "inet_ntoa_r.h"
 #endif
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 /***********************************************************************
  * Only for ares-enabled builds
Index: lib/hostasyn.c
===================================================================
RCS file: /repository/curl/lib/hostasyn.c,v
retrieving revision 1.1
diff -u -H -r1.1 hostasyn.c
--- lib/hostasyn.c 26 Apr 2004 07:20:11 -0000 1.1
+++ lib/hostasyn.c 11 May 2004 06:10:19 -0000
@@ -86,11 +86,7 @@
 #if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
 #include "inet_ntoa_r.h"
 #endif
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 /***********************************************************************
  * Only for builds using asynchronous name resolves
Index: lib/hostip.c
===================================================================
RCS file: /repository/curl/lib/hostip.c,v
retrieving revision 1.150
diff -u -H -r1.150 hostip.c
--- lib/hostip.c 4 May 2004 13:40:30 -0000 1.150
+++ lib/hostip.c 11 May 2004 06:10:20 -0000
@@ -86,11 +86,7 @@
 #if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
 #include "inet_ntoa_r.h"
 #endif
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 /*
  * hostip.c explained
Index: lib/hostip4.c
===================================================================
RCS file: /repository/curl/lib/hostip4.c,v
retrieving revision 1.2
diff -u -H -r1.2 hostip4.c
--- lib/hostip4.c 26 Apr 2004 12:02:33 -0000 1.2
+++ lib/hostip4.c 11 May 2004 06:10:21 -0000
@@ -86,11 +86,7 @@
 #if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
 #include "inet_ntoa_r.h"
 #endif
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 /***********************************************************************
  * Only for plain-ipv4 builds
Index: lib/hostip6.c
===================================================================
RCS file: /repository/curl/lib/hostip6.c,v
retrieving revision 1.3
diff -u -H -r1.3 hostip6.c
--- lib/hostip6.c 26 Apr 2004 15:11:56 -0000 1.3
+++ lib/hostip6.c 11 May 2004 06:10:21 -0000
@@ -87,11 +87,7 @@
 #if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
 #include "inet_ntoa_r.h"
 #endif
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 /***********************************************************************
  * Only for ipv6-enabled builds
Index: lib/hostsyn.c
===================================================================
RCS file: /repository/curl/lib/hostsyn.c,v
retrieving revision 1.1
diff -u -H -r1.1 hostsyn.c
--- lib/hostsyn.c 26 Apr 2004 07:20:11 -0000 1.1
+++ lib/hostsyn.c 11 May 2004 06:10:21 -0000
@@ -86,11 +86,7 @@
 #if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
 #include "inet_ntoa_r.h"
 #endif
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 /***********************************************************************
  * Only for builds using synchronous name resolves
Index: lib/hostthre.c
===================================================================
RCS file: /repository/curl/lib/hostthre.c,v
retrieving revision 1.5
diff -u -H -r1.5 hostthre.c
--- lib/hostthre.c 27 Apr 2004 15:13:46 -0000 1.5
+++ lib/hostthre.c 11 May 2004 06:10:22 -0000
@@ -82,13 +82,8 @@
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
-
 #include "inet_ntop.h"
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 /***********************************************************************
  * Only for Windows threaded name resolves builds
Index: lib/http.c
===================================================================
RCS file: /repository/curl/lib/http.c,v
retrieving revision 1.225
diff -u -H -r1.225 http.c
--- lib/http.c 10 May 2004 14:22:20 -0000 1.225
+++ lib/http.c 11 May 2004 06:10:25 -0000
@@ -97,11 +97,7 @@
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 /*
  * checkheaders() checks the linked list of custom HTTP headers for a
Index: lib/http_chunks.c
===================================================================
RCS file: /repository/curl/lib/http_chunks.c,v
retrieving revision 1.23
diff -u -H -r1.23 http_chunks.c
--- lib/http_chunks.c 4 Mar 2004 15:25:06 -0000 1.23
+++ lib/http_chunks.c 11 May 2004 06:10:25 -0000
@@ -38,11 +38,7 @@
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 /*
  * Chunk format (simplified):
Index: lib/http_digest.c
===================================================================
RCS file: /repository/curl/lib/http_digest.c,v
retrieving revision 1.16
diff -u -H -r1.16 http_digest.c
--- lib/http_digest.c 10 May 2004 08:09:15 -0000 1.16
+++ lib/http_digest.c 11 May 2004 06:10:26 -0000
@@ -41,11 +41,7 @@
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 /* Test example headers:
 
Index: lib/http_negotiate.c
===================================================================
RCS file: /repository/curl/lib/http_negotiate.c,v
retrieving revision 1.8
diff -u -H -r1.8 http_negotiate.c
--- lib/http_negotiate.c 27 Apr 2004 13:56:23 -0000 1.8
+++ lib/http_negotiate.c 11 May 2004 06:10:26 -0000
@@ -44,11 +44,7 @@
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 static int
 get_gss_name(struct connectdata *conn, gss_name_t *server)
Index: lib/http_ntlm.c
===================================================================
RCS file: /repository/curl/lib/http_ntlm.c,v
retrieving revision 1.31
diff -u -H -r1.31 http_ntlm.c
--- lib/http_ntlm.c 4 May 2004 07:52:53 -0000 1.31
+++ lib/http_ntlm.c 11 May 2004 06:10:27 -0000
@@ -49,6 +49,7 @@
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
+#include "memdebug.h"
 
 #include <openssl/des.h>
 #include <openssl/md4.h>
@@ -70,11 +71,6 @@
 #define DESKEY(x) &x
 #endif
 
-/* The last #include file should be: */
-#ifdef CURLDEBUG
-#include "memdebug.h"
-#endif
-
 /* Define this to make the type-3 message include the NT response message */
 #define USE_NTRESPONSES 1
 
Index: lib/if2ip.c
===================================================================
RCS file: /repository/curl/lib/if2ip.c,v
retrieving revision 1.33
diff -u -H -r1.33 if2ip.c
--- lib/if2ip.c 5 May 2004 13:42:23 -0000 1.33
+++ lib/if2ip.c 11 May 2004 06:10:27 -0000
@@ -73,11 +73,7 @@
 #endif
 
 #include "if2ip.h"
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 #define SYS_ERROR -1
 
Index: lib/inet_ntop.c
===================================================================
RCS file: /repository/curl/lib/inet_ntop.c,v
retrieving revision 1.2
diff -u -H -r1.2 inet_ntop.c
--- lib/inet_ntop.c 27 Apr 2004 14:17:36 -0000 1.2
+++ lib/inet_ntop.c 11 May 2004 06:10:27 -0000
@@ -31,6 +31,7 @@
    so we include our own proto to make compilers happy */
 #include "inet_ntoa_r.h"
 #endif
+#include "memdebug.h"
 
 #define IN6ADDRSZ 16
 #define INADDRSZ 4
Index: lib/inet_pton.c
===================================================================
RCS file: /repository/curl/lib/inet_pton.c,v
retrieving revision 1.6
diff -u -H -r1.6 inet_pton.c
--- lib/inet_pton.c 29 Jan 2004 13:56:45 -0000 1.6
+++ lib/inet_pton.c 11 May 2004 06:10:27 -0000
@@ -39,6 +39,7 @@
 #include <errno.h>
 
 #include "inet_pton.h"
+#include "memdebug.h"
 
 #define IN6ADDRSZ 16
 #define INADDRSZ 4
Index: lib/krb4.c
===================================================================
RCS file: /repository/curl/lib/krb4.c,v
retrieving revision 1.36
diff -u -H -r1.36 krb4.c
--- lib/krb4.c 28 Apr 2004 20:34:04 -0000 1.36
+++ lib/krb4.c 11 May 2004 06:10:28 -0000
@@ -64,11 +64,7 @@
 #if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
 #include "inet_ntoa_r.h"
 #endif
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 #define LOCAL_ADDR (&conn->local_addr)
 #define REMOTE_ADDR (&conn->serv_addr)
Index: lib/ldap.c
===================================================================
RCS file: /repository/curl/lib/ldap.c,v
retrieving revision 1.37
diff -u -H -r1.37 ldap.c
--- lib/ldap.c 6 May 2004 07:22:32 -0000 1.37
+++ lib/ldap.c 11 May 2004 06:10:29 -0000
@@ -59,10 +59,7 @@
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
-
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 /* WLdap32.dll functions are *not* stdcall. Must call these via __cdecl
  * pointers in case libcurl was compiled as fastcall (-Gr).
Index: lib/llist.c
===================================================================
RCS file: /repository/curl/lib/llist.c,v
retrieving revision 1.13
diff -u -H -r1.13 llist.c
--- lib/llist.c 10 May 2004 08:57:37 -0000 1.13
+++ lib/llist.c 11 May 2004 06:10:29 -0000
@@ -27,11 +27,8 @@
 #include <stdlib.h>
 
 #include "llist.h"
-
-#ifdef CURLDEBUG
-/* this must be the last include file */
 #include "memdebug.h"
-#endif
+
 void
 Curl_llist_init(curl_llist *l, curl_llist_dtor dtor)
 {
Index: lib/md5.c
===================================================================
RCS file: /repository/curl/lib/md5.c,v
retrieving revision 1.7
diff -u -H -r1.7 md5.c
--- lib/md5.c 20 Feb 2004 16:18:26 -0000 1.7
+++ lib/md5.c 11 May 2004 06:10:29 -0000
@@ -51,6 +51,7 @@
  */
 
 #include <string.h>
+#include "memdebug.h"
 
 /* UINT4 defines a four byte word */
 typedef unsigned int UINT4;
Index: lib/memdebug.c
===================================================================
RCS file: /repository/curl/lib/memdebug.c,v
retrieving revision 1.43
diff -u -H -r1.43 memdebug.c
--- lib/memdebug.c 5 May 2004 13:41:54 -0000 1.43
+++ lib/memdebug.c 11 May 2004 06:10:30 -0000
@@ -1,4 +1,3 @@
-#ifdef CURLDEBUG
 /***************************************************************************
  * _ _ ____ _
  * Project ___| | | | _ \| |
@@ -22,9 +21,35 @@
  * $Id: memdebug.c,v 1.43 2004/05/05 13:41:54 bagder Exp $
  ***************************************************************************/
 
-#include "setup.h"
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
 
 #include <curl/curl.h>
+#include "memdebug.h"
+
+/*
+ * Internal memory callback functions which are invoked instead of the
+ * standard memory management routines
+ */
+curlInternalStrdupFunc curl_istrdup = curl_dostrdup;
+curlInternalMallocFunc curl_imalloc = curl_domalloc;
+curlInternalCallocFunc curl_icalloc = curl_docalloc;
+curlInternalReallocFunc curl_irealloc = curl_dorealloc;
+curlInternalFreeFunc curl_ifree = curl_dofree;
+
+/*
+ * External memory callback functions which default to the standard C
+ * memory management functions. These can be replaced by the library user.
+ */
+curlStrdupFunc curl_cstrdup = ( strdup );
+curlMallocFunc curl_cmalloc = ( malloc );
+curlCallocFunc curl_ccalloc = ( calloc );
+curlReallocFunc curl_crealloc = ( realloc );
+curlFreeFunc curl_cfree = ( free );
+
+#ifdef CURLDEBUG
+#include "setup.h"
 
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
@@ -33,17 +58,10 @@
 #define _MPRINTF_REPLACE
 #include <curl/mprintf.h>
 #include "urldata.h"
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
-#define MEMDEBUG_NODEFINES /* don't redefine the standard functions */
-#include "memdebug.h"
-
 struct memdebug {
   size_t size;
   double mem[1];
@@ -68,7 +86,7 @@
 void curl_memdebug(const char *logname)
 {
   if(logname)
- logfile = fopen(logname, "w");
+ logfile = (fopen)(logname, "w");
   else
     logfile = stderr;
 }
@@ -282,11 +300,41 @@
             source, line, file);
   return res;
 }
-#else
+
+#else /* !CURLDEBUG */
+
 #ifdef VMS
-int VOID_VAR_MEMDEBUG;
+int VOID_VAR_MEMDEBUG;
 #else
 /* we provide a fake do-nothing function here to avoid compiler warnings */
 void curl_memdebug(void) {}
 #endif /* VMS */
+
+void *curl_domalloc(size_t wantedsize, int line, const char *source)
+{
+ return curl_cmalloc(wantedsize);
+}
+
+void *curl_dorealloc(void *ptr, size_t wantedsize, int line, const char *source)
+{
+ return curl_crealloc(ptr, wantedsize);
+}
+
+char *curl_dostrdup(const char *str, int line, const char *source)
+{
+ return curl_cstrdup(str);
+}
+
+void *curl_docalloc(size_t wanted_elements, size_t wanted_size, int line,
+ const char *source)
+{
+ return curl_ccalloc(wanted_elements, wanted_size);
+}
+
+void curl_dofree(void *ptr, int line, const char *source)
+{
+ curl_cfree(ptr);
+ return;
+}
+
 #endif /* CURLDEBUG */
Index: lib/memdebug.h
===================================================================
RCS file: /repository/curl/lib/memdebug.h,v
retrieving revision 1.27
diff -u -H -r1.27 memdebug.h
--- lib/memdebug.h 26 Apr 2004 07:20:11 -0000 1.27
+++ lib/memdebug.h 11 May 2004 06:10:30 -0000
@@ -1,4 +1,3 @@
-#ifdef CURLDEBUG
 #ifndef _CURL_MEDEBUG_H
 #define _CURL_MEDEBUG_H
 /***************************************************************************
@@ -24,11 +23,11 @@
  * $Id: memdebug.h,v 1.27 2004/04/26 07:20:11 bagder Exp $
  ***************************************************************************/
 
+#ifdef CURLDEBUG
 /*
  * CAUTION: this header is designed to work when included by the app-side
  * as well as the library. Do not mix with library internals!
  */
-
 #include "setup.h"
 
 #ifdef HAVE_SYS_TYPES_H
@@ -48,11 +47,6 @@
 extern FILE *logfile;
 
 /* memory functions */
-void *curl_domalloc(size_t size, int line, const char *source);
-void *curl_docalloc(size_t elements, size_t size, int line, const char *source);
-void *curl_dorealloc(void *ptr, size_t size, int line, const char *source);
-void curl_dofree(void *ptr, int line, const char *source);
-char *curl_dostrdup(const char *str, int line, const char *source);
 void curl_memdebug(const char *logname);
 void curl_memlimit(long limit);
 
@@ -67,16 +61,6 @@
                  const char *source);
 int curl_fclose(FILE *file, int line, const char *source);
 
-#ifndef MEMDEBUG_NODEFINES
-
-/* Set this symbol on the command-line, recompile all lib-sources */
-#undef strdup
-#define strdup(ptr) curl_dostrdup(ptr, __LINE__, __FILE__)
-#define malloc(size) curl_domalloc(size, __LINE__, __FILE__)
-#define calloc(nbelem,size) curl_docalloc(nbelem, size, __LINE__, __FILE__)
-#define realloc(ptr,size) curl_dorealloc(ptr, size, __LINE__, __FILE__)
-#define free(ptr) curl_dofree(ptr, __LINE__, __FILE__)
-
 #define socket(domain,type,protocol)\
  curl_socket(domain,type,protocol,__LINE__,__FILE__)
 #undef accept /* for those with accept as a macro */
@@ -102,7 +86,44 @@
 #define fopen(file,mode) curl_fopen(file,mode,__LINE__,__FILE__)
 #define fclose(file) curl_fclose(file,__LINE__,__FILE__)
 
-#endif /* MEMDEBUG_NODEFINES */
+#endif /* CURLDEBUG */
+
+#include <curl/curl.h>
+
+/*
+ * Internal memory management definitions. These are different from the
+ * external ones, because these function types take file and line arguments.
+ */
+typedef void *( *curlInternalMallocFunc ) ( size_t size, int line,
+ const char *file );
+typedef void ( *curlInternalFreeFunc ) ( void *ptr, int line,
+ const char *file );
+typedef char *( *curlInternalStrdupFunc ) ( const char *str, int line,
+ const char *file );
+typedef void *( *curlInternalReallocFunc )( void *ptr, size_t size,
+ int line, const char *file );
+typedef void *( *curlInternalCallocFunc ) ( size_t nmemb, size_t size,
+ int line, const char *file );
+
+/* These function types are defined in the memdebug.c */
+extern curlInternalStrdupFunc curl_istrdup;
+extern curlInternalMallocFunc curl_imalloc;
+extern curlInternalCallocFunc curl_icalloc;
+extern curlInternalReallocFunc curl_irealloc;
+extern curlInternalFreeFunc curl_ifree;
+
+/* Replace standard functions with the internal callback routines. */
+#undef strdup
+#define strdup( ptr ) curl_istrdup ( ptr, __LINE__, __FILE__ )
+#define malloc( size ) curl_imalloc ( size, __LINE__, __FILE__ )
+#define calloc( nmemb, size ) curl_icalloc ( nmemb, size, __LINE__, __FILE__ )
+#define realloc( ptr, size ) curl_irealloc ( ptr, size, __LINE__, __FILE__ )
+#define free( ptr ) curl_ifree ( ptr, __LINE__, __FILE__ )
+
+void *curl_domalloc(size_t size, int line, const char *source);
+void *curl_docalloc(size_t elements, size_t size, int line, const char *source);
+void *curl_dorealloc(void *ptr, size_t size, int line, const char *source);
+void curl_dofree(void *ptr, int line, const char *source);
+char *curl_dostrdup(const char *str, int line, const char *source);
 
 #endif /* _CURL_MEDEBUG_H */
-#endif /* CURLDEBUG */
Index: lib/mprintf.c
===================================================================
RCS file: /repository/curl/lib/mprintf.c,v
retrieving revision 1.41
diff -u -H -r1.41 mprintf.c
--- lib/mprintf.c 10 May 2004 10:50:43 -0000 1.41
+++ lib/mprintf.c 11 May 2004 06:10:31 -0000
@@ -39,6 +39,7 @@
 #include <string.h>
 
 #include <curl/mprintf.h>
+#include "memdebug.h"
 
 #ifndef SIZEOF_LONG_DOUBLE
 #define SIZEOF_LONG_DOUBLE 0
@@ -55,11 +56,6 @@
 #define ENABLE_64BIT
 #endif
 
-/* The last #include file should be: */
-#ifdef CURLDEBUG
-#include "memdebug.h"
-#endif
-
 #define BUFFSIZE 256 /* buffer for long-to-str and float-to-str calcs */
 #define MAX_PARAMETERS 128 /* lame static limit */
 
Index: lib/multi.c
===================================================================
RCS file: /repository/curl/lib/multi.c,v
retrieving revision 1.50
diff -u -H -r1.50 multi.c
--- lib/multi.c 26 Apr 2004 07:20:11 -0000 1.50
+++ lib/multi.c 11 May 2004 06:10:32 -0000
@@ -42,11 +42,7 @@
 #include "url.h"
 #include "connect.h"
 #include "progress.h"
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 struct Curl_message {
   /* the 'CURLMsg' is the part that is visible to the external user */
Index: lib/netrc.c
===================================================================
RCS file: /repository/curl/lib/netrc.c,v
retrieving revision 1.31
diff -u -H -r1.31 netrc.c
--- lib/netrc.c 23 Mar 2004 15:30:12 -0000 1.31
+++ lib/netrc.c 11 May 2004 06:10:32 -0000
@@ -48,11 +48,7 @@
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 /* Debug this single source file with:
    'make netrc' then run './netrc'!
Index: lib/nwlib.c
===================================================================
RCS file: /repository/curl/lib/nwlib.c,v
retrieving revision 1.2
diff -u -H -r1.2 nwlib.c
--- lib/nwlib.c 17 Mar 2004 13:36:45 -0000 1.2
+++ lib/nwlib.c 11 May 2004 06:10:33 -0000
@@ -30,6 +30,7 @@
 #include <nks/thread.h>
 #include <nks/synch.h>
 
+#include "memdebug.h"
 
 typedef struct
 {
Index: lib/progress.c
===================================================================
RCS file: /repository/curl/lib/progress.c,v
retrieving revision 1.68
diff -u -H -r1.68 progress.c
--- lib/progress.c 5 May 2004 14:22:46 -0000 1.68
+++ lib/progress.c 11 May 2004 06:10:34 -0000
@@ -37,6 +37,7 @@
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
+#include "memdebug.h"
 
 /* Provide a string that is 2 + 1 + 2 + 1 + 2 = 8 letters long (plus the zero
    byte) */
Index: lib/security.c
===================================================================
RCS file: /repository/curl/lib/security.c,v
retrieving revision 1.23
diff -u -H -r1.23 security.c
--- lib/security.c 2 Dec 2003 13:27:29 -0000 1.23
+++ lib/security.c 11 May 2004 06:10:34 -0000
@@ -58,11 +58,7 @@
 #include "base64.h"
 #include "sendf.h"
 #include "ftp.h"
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 #define min(a, b) ((a) < (b) ? (a) : (b))
 
Index: lib/sendf.c
===================================================================
RCS file: /repository/curl/lib/sendf.c,v
retrieving revision 1.83
diff -u -H -r1.83 sendf.c
--- lib/sendf.c 10 May 2004 14:21:19 -0000 1.83
+++ lib/sendf.c 11 May 2004 06:10:35 -0000
@@ -52,10 +52,8 @@
 #include "security.h"
 #endif
 #include <string.h>
-/* The last #include file should be: */
-#ifdef CURLDEBUG
+
 #include "memdebug.h"
-#endif
 
 /* returns last node in linked list */
 static struct curl_slist *slist_get_last(struct curl_slist *list)
Index: lib/share.c
===================================================================
RCS file: /repository/curl/lib/share.c,v
retrieving revision 1.17
diff -u -H -r1.17 share.c
--- lib/share.c 30 Mar 2004 13:02:31 -0000 1.17
+++ lib/share.c 11 May 2004 06:10:35 -0000
@@ -28,11 +28,7 @@
 #include <curl/curl.h>
 #include "urldata.h"
 #include "share.h"
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 CURLSH *
 curl_share_init(void)
Index: lib/speedcheck.c
===================================================================
RCS file: /repository/curl/lib/speedcheck.c,v
retrieving revision 1.19
diff -u -H -r1.19 speedcheck.c
--- lib/speedcheck.c 7 Jan 2004 09:19:35 -0000 1.19
+++ lib/speedcheck.c 11 May 2004 06:10:35 -0000
@@ -30,6 +30,7 @@
 #include "urldata.h"
 #include "sendf.h"
 #include "speedcheck.h"
+#include "memdebug.h"
 
 void Curl_speedinit(struct SessionHandle *data)
 {
Index: lib/ssluse.c
===================================================================
RCS file: /repository/curl/lib/ssluse.c,v
retrieving revision 1.98
diff -u -H -r1.98 ssluse.c
--- lib/ssluse.c 29 Apr 2004 07:36:40 -0000 1.98
+++ lib/ssluse.c 11 May 2004 06:10:37 -0000
@@ -50,10 +50,7 @@
 #include <openssl/rand.h>
 #include <openssl/x509v3.h>
 
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 #if OPENSSL_VERSION_NUMBER >= 0x0090581fL
 #define HAVE_SSL_GET1_SESSION 1
Index: lib/strequal.c
===================================================================
RCS file: /repository/curl/lib/strequal.c,v
retrieving revision 1.25
diff -u -H -r1.25 strequal.c
--- lib/strequal.c 29 Jan 2004 13:56:45 -0000 1.25
+++ lib/strequal.c 11 May 2004 06:10:37 -0000
@@ -27,6 +27,7 @@
 #include <ctype.h>
 
 #include "strequal.h"
+#include "memdebug.h"
 
 #ifdef HAVE_STRCASECMP
 /* this is for "-ansi -Wall -pedantic" to stop complaining! */
Index: lib/strerror.c
===================================================================
RCS file: /repository/curl/lib/strerror.c,v
retrieving revision 1.8
diff -u -H -r1.8 strerror.c
--- lib/strerror.c 6 May 2004 10:49:40 -0000 1.8
+++ lib/strerror.c 11 May 2004 06:10:37 -0000
@@ -31,6 +31,7 @@
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
+#include "memdebug.h"
 
 #ifdef HAVE_NO_STRERROR_R_DECL
 #ifdef HAVE_POSIX_STRERROR_R
Index: lib/strtok.c
===================================================================
RCS file: /repository/curl/lib/strtok.c,v
retrieving revision 1.13
diff -u -H -r1.13 strtok.c
--- lib/strtok.c 29 Jan 2004 13:56:45 -0000 1.13
+++ lib/strtok.c 11 May 2004 06:10:38 -0000
@@ -28,6 +28,7 @@
 #include <string.h>
 
 #include "strtok.h"
+#include "memdebug.h"
 
 char *
 Curl_strtok_r(char *ptr, const char *sep, char **end)
Index: lib/strtoofft.c
===================================================================
RCS file: /repository/curl/lib/strtoofft.c,v
retrieving revision 1.5
diff -u -H -r1.5 strtoofft.c
--- lib/strtoofft.c 19 Feb 2004 08:12:13 -0000 1.5
+++ lib/strtoofft.c 11 May 2004 06:10:38 -0000
@@ -29,6 +29,8 @@
 #include <ctype.h>
 #include <errno.h>
 
+#include "memdebug.h"
+
 static int get_char(char c, int base);
 
 /**
Index: lib/telnet.c
===================================================================
RCS file: /repository/curl/lib/telnet.c,v
retrieving revision 1.59
diff -u -H -r1.59 telnet.c
--- lib/telnet.c 26 Apr 2004 07:50:51 -0000 1.59
+++ lib/telnet.c 11 May 2004 06:10:39 -0000
@@ -65,7 +65,6 @@
 #include <sys/select.h>
 #endif
 
-
 #endif
 
 #include "urldata.h"
@@ -81,11 +80,7 @@
 #define TELCMDS
 
 #include "arpa_telnet.h"
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 #define SUBBUFSIZE 512
 
Index: lib/timeval.c
===================================================================
RCS file: /repository/curl/lib/timeval.c,v
retrieving revision 1.23
diff -u -H -r1.23 timeval.c
--- lib/timeval.c 9 Apr 2004 09:36:31 -0000 1.23
+++ lib/timeval.c 11 May 2004 06:10:40 -0000
@@ -22,6 +22,7 @@
  ***************************************************************************/
 
 #include "timeval.h"
+#include "memdebug.h"
 
 #ifndef HAVE_GETTIMEOFDAY
 
Index: lib/transfer.c
===================================================================
RCS file: /repository/curl/lib/transfer.c,v
retrieving revision 1.226
diff -u -H -r1.226 transfer.c
--- lib/transfer.c 5 May 2004 06:57:26 -0000 1.226
+++ lib/transfer.c 11 May 2004 06:10:44 -0000
@@ -104,11 +104,7 @@
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 #define CURL_TIMEOUT_EXPECT_100 1000 /* counting ms here */
 
Index: lib/url.c
===================================================================
RCS file: /repository/curl/lib/url.c,v
retrieving revision 1.373
diff -u -H -r1.373 url.c
--- lib/url.c 7 May 2004 18:46:28 -0000 1.373
+++ lib/url.c 11 May 2004 06:10:48 -0000
@@ -135,10 +135,7 @@
 #include "security.h"
 #endif
 
-/* The last #include file should be: */
-#ifdef CURLDEBUG
 #include "memdebug.h"
-#endif
 
 /* Local static prototypes */
 static int ConnectionKillOne(struct SessionHandle *data);
Index: lib/version.c
===================================================================
RCS file: /repository/curl/lib/version.c,v
retrieving revision 1.38
diff -u -H -r1.38 version.c
--- lib/version.c 6 May 2004 07:32:30 -0000 1.38
+++ lib/version.c 11 May 2004 06:10:49 -0000
@@ -37,6 +37,8 @@
 #include <stringprep.h>
 #endif
 
+#include "memdebug.h"
+
 #ifdef USE_SSLEAY
 static void getssl_version(char *ptr, long *num)
 {
Index: src/getpass.c
===================================================================
RCS file: /repository/curl/src/getpass.c,v
retrieving revision 1.6
diff -u -H -r1.6 getpass.c
--- src/getpass.c 10 Mar 2004 16:03:12 -0000 1.6
+++ src/getpass.c 11 May 2004 06:10:50 -0000
@@ -93,10 +93,7 @@
 # endif
 #endif
 
-/* The last #include file should be: */
-#ifdef CURLDEBUG
-#include "../lib/memdebug.h"
-#endif
+#include "memdebug.h"
 
 char *getpass_r(const char *prompt, char *buffer, size_t buflen)
 {
Index: src/homedir.c
===================================================================
RCS file: /repository/curl/src/homedir.c,v
retrieving revision 1.4
diff -u -H -r1.4 homedir.c
--- src/homedir.c 29 Jan 2004 13:54:08 -0000 1.4
+++ src/homedir.c 11 May 2004 06:10:50 -0000
@@ -41,10 +41,7 @@
 #endif
 
 #include "homedir.h"
-
-#ifdef CURLDEBUG
-#include "../lib/memdebug.h"
-#endif
+#include "memdebug.h"
 
 static
 char *GetEnv(const char *variable, char do_expand)
Index: src/main.c
===================================================================
RCS file: /repository/curl/src/main.c,v
retrieving revision 1.264
diff -u -H -r1.264 main.c
--- src/main.c 10 May 2004 14:45:11 -0000 1.264
+++ src/main.c 11 May 2004 06:10:56 -0000
@@ -104,14 +104,7 @@
 /* make the curlx header define all printf() functions to use the curlx_*
    versions instead */
 #include <curlx.h> /* header from the libcurl directory */
-
-/* The last #include file should be: */
-#ifdef CURLDEBUG
-/* This is low-level hard-hacking memory leak tracking and similar. Using
- the library level code from this client-side is ugly, but we do this
- anyway for convenience. */
 #include "memdebug.h"
-#endif
 
 #define DEFAULT_MAXREDIRS 50L
 
Index: src/urlglob.c
===================================================================
RCS file: /repository/curl/src/urlglob.c,v
retrieving revision 1.33
diff -u -H -r1.33 urlglob.c
--- src/urlglob.c 6 Apr 2004 07:48:29 -0000 1.33
+++ src/urlglob.c 11 May 2004 06:10:56 -0000
@@ -32,13 +32,8 @@
 
 #define _MPRINTF_REPLACE /* we want curl-functions instead of native ones */
 #include <curl/mprintf.h>
-
 #include "urlglob.h"
-
-
-#ifdef CURLDEBUG
-#include "../lib/memdebug.h"
-#endif
+#include "memdebug.h"
 
 typedef enum {
   GLOB_OK,
Index: src/writeenv.c
===================================================================
RCS file: /repository/curl/src/writeenv.c,v
retrieving revision 1.8
diff -u -H -r1.8 writeenv.c
--- src/writeenv.c 29 Mar 2004 12:29:26 -0000 1.8
+++ src/writeenv.c 11 May 2004 06:10:57 -0000
@@ -31,6 +31,8 @@
 #include <kernel.h>
 #endif
 
+#include "memdebug.h"
+
 struct
 {
   const char * name;
Index: src/writeout.c
===================================================================
RCS file: /repository/curl/src/writeout.c,v
retrieving revision 1.22
diff -u -H -r1.22 writeout.c
--- src/writeout.c 5 May 2004 09:20:08 -0000 1.22
+++ src/writeout.c 11 May 2004 06:10:57 -0000
@@ -37,8 +37,8 @@
 
 #define _MPRINTF_REPLACE /* we want curl-functions instead of native ones */
 #include <curl/mprintf.h>
-
 #include "writeout.h"
+#include "memdebug.h"
 
 typedef enum {
   VAR_NONE, /* must be the first */

Received on 2004-05-11