1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-15 22:15:13 -05:00

Revert "WIN32 MemoryTracking: track wcsdup() _wcsdup() and _tcsdup() usage"

This reverts commit 8ec2cb5544.

We don't have any code anywhere in libcurl (or the curl tool) that use
wcsdup so there's no such memory use to track. It seems to cause mild
problems with the Borland compiler though that we may avoid by reverting
this change again.

Bug: http://curl.haxx.se/mail/lib-2013-05/0070.html
This commit is contained in:
Daniel Stenberg 2013-05-12 15:10:01 +02:00
parent 01eede2662
commit 7ed25ccf0d
7 changed files with 3 additions and 94 deletions

View File

@ -87,9 +87,6 @@ extern curl_free_callback Curl_cfree;
extern curl_realloc_callback Curl_crealloc; extern curl_realloc_callback Curl_crealloc;
extern curl_strdup_callback Curl_cstrdup; extern curl_strdup_callback Curl_cstrdup;
extern curl_calloc_callback Curl_ccalloc; extern curl_calloc_callback Curl_ccalloc;
#ifdef WIN32
extern curl_wcsdup_callback Curl_cwcsdup;
#endif
#ifndef CURLDEBUG #ifndef CURLDEBUG
@ -113,19 +110,6 @@ extern curl_wcsdup_callback Curl_cwcsdup;
#undef free #undef free
#define free(ptr) Curl_cfree(ptr) #define free(ptr) Curl_cfree(ptr)
#ifdef WIN32
# undef wcsdup
# define wcsdup(ptr) Curl_cwcsdup(ptr)
# undef _wcsdup
# define _wcsdup(ptr) Curl_cwcsdup(ptr)
# undef _tcsdup
# ifdef UNICODE
# define _tcsdup(ptr) Curl_cwcsdup(ptr)
# else
# define _tcsdup(ptr) Curl_cstrdup(ptr)
# endif
#endif
#endif /* CURLDEBUG */ #endif /* CURLDEBUG */
#else /* CURLX_NO_MEMORY_CALLBACKS */ #else /* CURLX_NO_MEMORY_CALLBACKS */

View File

@ -270,7 +270,6 @@
# endif # endif
# endif # endif
# include <tchar.h> # include <tchar.h>
typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
#endif #endif
/* /*

View File

@ -198,9 +198,6 @@ curl_free_callback Curl_cfree = (curl_free_callback)free;
curl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc; curl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc;
curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)system_strdup; curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)system_strdup;
curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc; curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc;
#ifdef WIN32
curl_wcsdup_callback Curl_cwcsdup = (curl_wcsdup_callback)wcsdup;
#endif
#else #else
/* /*
* Symbian OS doesn't support initialization to code in writeable static data. * Symbian OS doesn't support initialization to code in writeable static data.
@ -232,9 +229,6 @@ CURLcode curl_global_init(long flags)
Curl_crealloc = (curl_realloc_callback)realloc; Curl_crealloc = (curl_realloc_callback)realloc;
Curl_cstrdup = (curl_strdup_callback)system_strdup; Curl_cstrdup = (curl_strdup_callback)system_strdup;
Curl_ccalloc = (curl_calloc_callback)calloc; Curl_ccalloc = (curl_calloc_callback)calloc;
#ifdef WIN32
Curl_cwcsdup = (curl_wcsdup_callback)wcsdup;
#endif
if(flags & CURL_GLOBAL_SSL) if(flags & CURL_GLOBAL_SSL)
if(!Curl_ssl_init()) { if(!Curl_ssl_init()) {

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -239,32 +239,6 @@ char *curl_dostrdup(const char *str, int line, const char *source)
return mem; return mem;
} }
#ifdef WIN32
wchar_t *curl_dowcsdup(const wchar_t *str, int line, const char *source)
{
wchar_t *mem;
size_t wsiz, bsiz;
assert(str != NULL);
if(countcheck("wcsdup", line, source))
return NULL;
wsiz = wcslen(str) + 1;
bsiz = wsiz * sizeof(wchar_t);
mem = curl_domalloc(bsiz, 0, NULL); /* NULL prevents logging */
if(mem)
memcpy(mem, str, bsiz);
if(source)
curl_memlog("MEM %s:%d wcsdup(%p) (%zu) = %p\n",
source, line, str, bsiz, mem);
return mem;
}
#endif
/* We provide a realloc() that accepts a NULL as pointer, which then /* We provide a realloc() that accepts a NULL as pointer, which then
performs a malloc(). In order to work with ares. */ performs a malloc(). In order to work with ares. */
void *curl_dorealloc(void *ptr, size_t wantedsize, void *curl_dorealloc(void *ptr, size_t wantedsize,

View File

@ -8,7 +8,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -46,11 +46,6 @@ CURL_EXTERN void *curl_dorealloc(void *ptr, size_t size, int line,
const char *source); const char *source);
CURL_EXTERN void curl_dofree(void *ptr, int line, const char *source); CURL_EXTERN void curl_dofree(void *ptr, int line, const char *source);
CURL_EXTERN char *curl_dostrdup(const char *str, int line, const char *source); CURL_EXTERN char *curl_dostrdup(const char *str, int line, const char *source);
#ifdef WIN32
CURL_EXTERN wchar_t *curl_dowcsdup(const wchar_t *str, int line,
const char *source);
#endif
CURL_EXTERN void curl_memdebug(const char *logname); CURL_EXTERN void curl_memdebug(const char *logname);
CURL_EXTERN void curl_memlimit(long limit); CURL_EXTERN void curl_memlimit(long limit);
CURL_EXTERN void curl_memlog(const char *format, ...); CURL_EXTERN void curl_memlog(const char *format, ...);
@ -89,19 +84,6 @@ CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source);
#define realloc(ptr,size) curl_dorealloc(ptr, size, __LINE__, __FILE__) #define realloc(ptr,size) curl_dorealloc(ptr, size, __LINE__, __FILE__)
#define free(ptr) curl_dofree(ptr, __LINE__, __FILE__) #define free(ptr) curl_dofree(ptr, __LINE__, __FILE__)
#ifdef WIN32
# undef wcsdup
# define wcsdup(ptr) curl_dowcsdup(ptr, __LINE__, __FILE__)
# undef _wcsdup
# define _wcsdup(ptr) curl_dowcsdup(ptr, __LINE__, __FILE__)
# undef _tcsdup
# ifdef UNICODE
# define _tcsdup(ptr) curl_dowcsdup(ptr, __LINE__, __FILE__)
# else
# define _tcsdup(ptr) curl_dostrdup(ptr, __LINE__, __FILE__)
# endif
#endif
#define socket(domain,type,protocol)\ #define socket(domain,type,protocol)\
curl_socket(domain,type,protocol,__LINE__,__FILE__) curl_socket(domain,type,protocol,__LINE__,__FILE__)
#undef accept /* for those with accept as a macro */ #undef accept /* for those with accept as a macro */

View File

@ -31,7 +31,6 @@ my $mallocs=0;
my $callocs=0; my $callocs=0;
my $reallocs=0; my $reallocs=0;
my $strdups=0; my $strdups=0;
my $wcsdups=0;
my $showlimit; my $showlimit;
while(1) { while(1) {
@ -221,25 +220,6 @@ while(<FILE>) {
newtotal($totalmem); newtotal($totalmem);
$strdups++; $strdups++;
} }
elsif($function =~ /wcsdup\(0x([0-9a-f]*)\) \((\d*)\) = 0x([0-9a-f]*)/) {
# wcsdup(a5b50) (8) = df7c0
$dup = $1;
$size = $2;
$addr = $3;
$getmem{$addr}="$source:$linenum";
$sizeataddr{$addr}=$size;
$totalmem += $size;
if($trace) {
printf("WCSDUP: $size bytes at %s, makes totally: %d bytes\n",
$getmem{$addr}, $totalmem);
}
newtotal($totalmem);
$wcsdups++;
}
else { else {
print "Not recognized input line: $function\n"; print "Not recognized input line: $function\n";
} }
@ -398,9 +378,8 @@ if($verbose) {
"Reallocs: $reallocs\n", "Reallocs: $reallocs\n",
"Callocs: $callocs\n", "Callocs: $callocs\n",
"Strdups: $strdups\n", "Strdups: $strdups\n",
"Wcsdups: $wcsdups\n",
"Frees: $frees\n", "Frees: $frees\n",
"Allocations: ".($mallocs + $callocs + $reallocs + $strdups + $wcsdups)."\n"; "Allocations: ".($mallocs + $callocs + $reallocs + $strdups)."\n";
print "Maximum allocated: $maxmem\n"; print "Maximum allocated: $maxmem\n";
} }

View File

@ -58,9 +58,6 @@ curl_free_callback Curl_cfree = (curl_free_callback)free;
curl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc; curl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc;
curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)strdup; curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)strdup;
curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc; curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc;
#ifdef WIN32
curl_wcsdup_callback Curl_cwcsdup = (curl_wcsdup_callback)wcsdup;
#endif
#if defined(_MSC_VER) && defined(_DLL) #if defined(_MSC_VER) && defined(_DLL)
# pragma warning(default:4232) /* MSVC extension, dllimport identity */ # pragma warning(default:4232) /* MSVC extension, dllimport identity */