cURL / Mailing Lists / curl-library / Single Mail

curl-library

Fwd: [bagder/curl] 8ec2cb5544 WIN32 MemoryTracking

From: Yang Tse <yangsita_at_gmail.com>
Date: Thu, 18 Jul 2013 22:11:33 +0200

Forwarding to the list, given I sent it privately unintentionally...

---------- Forwarded message ----------
From: Yang Tse <yangsita_at_gmail.com>
Date: Thu, Jul 18, 2013 at 8:33 PM
Subject: Re: [bagder/curl] 8ec2cb5544 WIN32 MemoryTracking
To: Daniel Stenberg <daniel_at_haxx.se>

On Tue, May 7, 2013, Daniel Stenberg <daniel_at_haxx.se> wrote:

> There's no code in libcurl that uses wcsdup() from what I can tell. Why
> provide memory debug code for it?

Ouch! There is.

Find below commit message I'm preparing in order to reinstate this
commit. If any compiler is supposedly capable of building Windows
targets and it has problems with this basic stuff it should be
investigated if there's a real problem with compiler's headers, or if
there's any problem related with user's specific installation.

Ok to reinstate?

Reinstating commit message follows...

----------

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

This reverts commit 7ed25cc, reinstating commit 8ec2cb5.

As of 18-jul-2013 we still do have code in libcurl that makes use of
these memory functions. Commit 8ec2cb5 comment still applies and is
yet valid.

These memory functions are solely used in Windows builds, so all
related code is protected with '#ifdef WIN32' preprocessor conditional
compilation directives.

Specifically, wcsdup() _wcsdup() are used when building a Windows
target with UNICODE and USE_WINDOWS_SSPI preprocessor symbols defined.
This is the case when building a Windows UNICODE target with Windows
native SSL/TLS support enabled.

Realizing that wcsdup() _wcsdup() are used is a bit tricky given that
usage of these is hidden behind _tcsdup() which is MS way of dealing
with code that must tolerate UNICODE and non-UNICODE compilation.
Additionally, MS header files and those compatible from other
compilers use this preprocessor conditional compilation directive in
order to select at compilation time whether 'wide' or 'ansi' MS API
functions are used.

Without this code, Windows build targets with Windows native SSL/TLS
support enabled and MemoryTracking support enabled misbehave in
tracking memory usage, regardless of being a UNICODE enabled build or
not.

It's MS platform, so MS imposes their rules when dealing with their API.

--
-=[Yang]=-
-- 
-=[Yang]=-
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-07-18