Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Commit 7ed25cc

Browse files
committed
Revert "WIN32 MemoryTracking: track wcsdup() _wcsdup() and _tcsdup() usage"
This reverts commit 8ec2cb5. 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
1 parent 01eede2 commit 7ed25cc

File tree

7 files changed

+3
-94
lines changed

7 files changed

+3
-94
lines changed

lib/curl_memory.h

-16
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ extern curl_free_callback Curl_cfree;
8787
extern curl_realloc_callback Curl_crealloc;
8888
extern curl_strdup_callback Curl_cstrdup;
8989
extern curl_calloc_callback Curl_ccalloc;
90-
#ifdef WIN32
91-
extern curl_wcsdup_callback Curl_cwcsdup;
92-
#endif
9390

9491
#ifndef CURLDEBUG
9592

@@ -113,19 +110,6 @@ extern curl_wcsdup_callback Curl_cwcsdup;
113110
#undef free
114111
#define free(ptr) Curl_cfree(ptr)
115112

116-
#ifdef WIN32
117-
# undef wcsdup
118-
# define wcsdup(ptr) Curl_cwcsdup(ptr)
119-
# undef _wcsdup
120-
# define _wcsdup(ptr) Curl_cwcsdup(ptr)
121-
# undef _tcsdup
122-
# ifdef UNICODE
123-
# define _tcsdup(ptr) Curl_cwcsdup(ptr)
124-
# else
125-
# define _tcsdup(ptr) Curl_cstrdup(ptr)
126-
# endif
127-
#endif
128-
129113
#endif /* CURLDEBUG */
130114

131115
#else /* CURLX_NO_MEMORY_CALLBACKS */

lib/curl_setup.h

-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@
270270
# endif
271271
# endif
272272
# include <tchar.h>
273-
typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
274273
#endif
275274

276275
/*

lib/easy.c

-6
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,6 @@ curl_free_callback Curl_cfree = (curl_free_callback)free;
198198
curl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc;
199199
curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)system_strdup;
200200
curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc;
201-
#ifdef WIN32
202-
curl_wcsdup_callback Curl_cwcsdup = (curl_wcsdup_callback)wcsdup;
203-
#endif
204201
#else
205202
/*
206203
* Symbian OS doesn't support initialization to code in writeable static data.
@@ -232,9 +229,6 @@ CURLcode curl_global_init(long flags)
232229
Curl_crealloc = (curl_realloc_callback)realloc;
233230
Curl_cstrdup = (curl_strdup_callback)system_strdup;
234231
Curl_ccalloc = (curl_calloc_callback)calloc;
235-
#ifdef WIN32
236-
Curl_cwcsdup = (curl_wcsdup_callback)wcsdup;
237-
#endif
238232

239233
if(flags & CURL_GLOBAL_SSL)
240234
if(!Curl_ssl_init()) {

lib/memdebug.c

+1-27
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* | (__| |_| | _ <| |___
66
* \___|\___/|_| \_\_____|
77
*
8-
* Copyright (C) 1998 - 2013, Daniel Stenberg, <[email protected]>, et al.
8+
* Copyright (C) 1998 - 2012, Daniel Stenberg, <[email protected]>, et al.
99
*
1010
* This software is licensed as described in the file COPYING, which
1111
* 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)
239239
return mem;
240240
}
241241

242-
#ifdef WIN32
243-
wchar_t *curl_dowcsdup(const wchar_t *str, int line, const char *source)
244-
{
245-
wchar_t *mem;
246-
size_t wsiz, bsiz;
247-
248-
assert(str != NULL);
249-
250-
if(countcheck("wcsdup", line, source))
251-
return NULL;
252-
253-
wsiz = wcslen(str) + 1;
254-
bsiz = wsiz * sizeof(wchar_t);
255-
256-
mem = curl_domalloc(bsiz, 0, NULL); /* NULL prevents logging */
257-
if(mem)
258-
memcpy(mem, str, bsiz);
259-
260-
if(source)
261-
curl_memlog("MEM %s:%d wcsdup(%p) (%zu) = %p\n",
262-
source, line, str, bsiz, mem);
263-
264-
return mem;
265-
}
266-
#endif
267-
268242
/* We provide a realloc() that accepts a NULL as pointer, which then
269243
performs a malloc(). In order to work with ares. */
270244
void *curl_dorealloc(void *ptr, size_t wantedsize,

lib/memdebug.h

+1-19
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* | (__| |_| | _ <| |___
99
* \___|\___/|_| \_\_____|
1010
*
11-
* Copyright (C) 1998 - 2013, Daniel Stenberg, <[email protected]>, et al.
11+
* Copyright (C) 1998 - 2012, Daniel Stenberg, <[email protected]>, et al.
1212
*
1313
* This software is licensed as described in the file COPYING, which
1414
* 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,
4646
const char *source);
4747
CURL_EXTERN void curl_dofree(void *ptr, int line, const char *source);
4848
CURL_EXTERN char *curl_dostrdup(const char *str, int line, const char *source);
49-
#ifdef WIN32
50-
CURL_EXTERN wchar_t *curl_dowcsdup(const wchar_t *str, int line,
51-
const char *source);
52-
#endif
53-
5449
CURL_EXTERN void curl_memdebug(const char *logname);
5550
CURL_EXTERN void curl_memlimit(long limit);
5651
CURL_EXTERN void curl_memlog(const char *format, ...);
@@ -89,19 +84,6 @@ CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source);
8984
#define realloc(ptr,size) curl_dorealloc(ptr, size, __LINE__, __FILE__)
9085
#define free(ptr) curl_dofree(ptr, __LINE__, __FILE__)
9186

92-
#ifdef WIN32
93-
# undef wcsdup
94-
# define wcsdup(ptr) curl_dowcsdup(ptr, __LINE__, __FILE__)
95-
# undef _wcsdup
96-
# define _wcsdup(ptr) curl_dowcsdup(ptr, __LINE__, __FILE__)
97-
# undef _tcsdup
98-
# ifdef UNICODE
99-
# define _tcsdup(ptr) curl_dowcsdup(ptr, __LINE__, __FILE__)
100-
# else
101-
# define _tcsdup(ptr) curl_dostrdup(ptr, __LINE__, __FILE__)
102-
# endif
103-
#endif
104-
10587
#define socket(domain,type,protocol)\
10688
curl_socket(domain,type,protocol,__LINE__,__FILE__)
10789
#undef accept /* for those with accept as a macro */

tests/memanalyze.pl

+1-22
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
my $callocs=0;
3232
my $reallocs=0;
3333
my $strdups=0;
34-
my $wcsdups=0;
3534
my $showlimit;
3635

3736
while(1) {
@@ -221,25 +220,6 @@ sub newtotal {
221220
newtotal($totalmem);
222221
$strdups++;
223222
}
224-
elsif($function =~ /wcsdup\(0x([0-9a-f]*)\) \((\d*)\) = 0x([0-9a-f]*)/) {
225-
# wcsdup(a5b50) (8) = df7c0
226-
227-
$dup = $1;
228-
$size = $2;
229-
$addr = $3;
230-
$getmem{$addr}="$source:$linenum";
231-
$sizeataddr{$addr}=$size;
232-
233-
$totalmem += $size;
234-
235-
if($trace) {
236-
printf("WCSDUP: $size bytes at %s, makes totally: %d bytes\n",
237-
$getmem{$addr}, $totalmem);
238-
}
239-
240-
newtotal($totalmem);
241-
$wcsdups++;
242-
}
243223
else {
244224
print "Not recognized input line: $function\n";
245225
}
@@ -398,9 +378,8 @@ sub newtotal {
398378
"Reallocs: $reallocs\n",
399379
"Callocs: $callocs\n",
400380
"Strdups: $strdups\n",
401-
"Wcsdups: $wcsdups\n",
402381
"Frees: $frees\n",
403-
"Allocations: ".($mallocs + $callocs + $reallocs + $strdups + $wcsdups)."\n";
382+
"Allocations: ".($mallocs + $callocs + $reallocs + $strdups)."\n";
404383

405384
print "Maximum allocated: $maxmem\n";
406385
}

tests/server/getpart.c

-3
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ curl_free_callback Curl_cfree = (curl_free_callback)free;
5858
curl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc;
5959
curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)strdup;
6060
curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc;
61-
#ifdef WIN32
62-
curl_wcsdup_callback Curl_cwcsdup = (curl_wcsdup_callback)wcsdup;
63-
#endif
6461

6562
#if defined(_MSC_VER) && defined(_DLL)
6663
# pragma warning(default:4232) /* MSVC extension, dllimport identity */

0 commit comments

Comments
 (0)