On Wed, 5 Nov 2014, Steve Holme wrote:

I see from the above commit that the curl command line tool now has tool_strdup.c|h rather than using strdup.c|h from curl.

Correct, it messed up the build due to the memory defines and I decided it wasn't worth doing any funny tricks as it is a fairly small thing anyway. I was also under a time pressure when I decided that was the quickest route forward.

As such I need to fix up generate.bat as the few files that are included from libcurl are currently hard coded in there (as I don't parse the makefiles in this batch file as it is intended for use on Windows when working directly from the repo).

Yes, but I also don't think there are very many systems around today that lack strdup. I would guess that those that do exist all use configure to build.

Should the new Curl_memdup() function be located in a new curl_memdup.c|h (like curl_memchr.c|h) or even curl_memory.c instead rather than having two versions of the strdup() function?

I don't think so.

Looking at it now, I think it used to work before only because nobody ever really used our own strdup version. Such users would then have gotten a version of the problem we saw now. It would've used memory functions without the proper include files so a debug version of libcurl would crash or at best just fail to link.

Sharing code isn't so easy between the tool and the lib, and especially not code that uses allocations or anything else that memdebug.h "tracks".

So, I think we should instead make sure that systems that might not have strdup build and use tool_strdup.c in the curl tool build.

--

 / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to