summaryrefslogtreecommitdiff
path: root/lib/curl_memory.h
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2013-03-25 03:15:52 +0100
committerYang Tse <yangsita@gmail.com>2013-03-25 03:32:47 +0100
commit8ec2cb5544b86306b702484ea785b6b9596562ab (patch)
tree55952aea963b504165c3246768c93b21d6375958 /lib/curl_memory.h
parentc5eabd48e8dbc8393723bb79f0040475d850f389 (diff)
downloadcurl-8ec2cb5544b86306b702484ea785b6b9596562ab.tar.gz
WIN32 MemoryTracking: track wcsdup() _wcsdup() and _tcsdup() usage
As of 25-mar-2013 wcsdup() _wcsdup() and _tcsdup() are only used in WIN32 specific code, so tracking of these has not been extended for other build targets. Without this fix, memory tracking system on WIN32 builds, when using these functions, would provide misleading results. In order to properly extend this support for all targets curl.h would have to define curl_wcsdup_callback prototype and consequently wchar_t should be visible before that in curl.h. IOW curl_wchar_t defined in curlbuild.h and this pulling whatever system header is required to get wchar_t definition. Additionally a new curl_global_init_mem() function that also receives user defined wcsdup() callback would be required.
Diffstat (limited to 'lib/curl_memory.h')
-rw-r--r--lib/curl_memory.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/curl_memory.h b/lib/curl_memory.h
index c1e92513f..4bba008c9 100644
--- a/lib/curl_memory.h
+++ b/lib/curl_memory.h
@@ -87,6 +87,9 @@ extern curl_free_callback Curl_cfree;
extern curl_realloc_callback Curl_crealloc;
extern curl_strdup_callback Curl_cstrdup;
extern curl_calloc_callback Curl_ccalloc;
+#ifdef WIN32
+extern curl_wcsdup_callback Curl_cwcsdup;
+#endif
#ifndef CURLDEBUG
@@ -110,6 +113,19 @@ extern curl_calloc_callback Curl_ccalloc;
#undef free
#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 */
#else /* CURLX_NO_MEMORY_CALLBACKS */