cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Problem with strdup

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Sat, 18 Dec 2004 23:23:05 +0100 (CET)

On Sat, 18 Dec 2004, Eric VERGNAUD wrote:

>> The strdup() function returns a pointer to a new string which is a
>> duplicate of the string s. Memory for the new string is obtained with
>> malloc(3), and can be freed with free(3).
>
> The problem is that Metrowerk's C library provides its own implementation of
> malloc and free. I think this is because that C library is meant to compile
> and link under both MacOS 9 (which has no malloc) and MacOS X.

So it provides malloc and free but not strdup?

> Since libcurl is compiled using gcc, it links with apple's malloc and free
> while strdup internally calls Metrowerk's free (defined as _sys_free).

I get confused. Why does libcurl use Apple's malloc/free but Metrowerk's
strdup? The libc provided by Apple has a strdup too, surely?

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-12-18