cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: strdup

From: Yang Tse <yangsita_at_gmail.com>
Date: Fri, 12 Jul 2013 19:57:04 +0200

Patrick Monnerat wrote:

> Your patch is OK for lib1900.c, but not for lib509.c because it uses
>
> (strdup)(ptr)
>
> However by changing your patch to
>
> #define strdup curlx_strdup
>
> It compiles fine with that.

Hi :-)

I don't foresee any problem in libtest programs if your #define was
used. Platforms which do have strdup wouldn't be affected.

> The next failure is linking: I do not export curlx_* symbols :-(

You would need to modify whichever packages/OS400 script is parsing
tests/libtest/Makefile.inc to generate your libtest/Makefile, in such
a way that '../../lib/strdup.c' is appended to lib509_SOURCES and
lib1900_SOURCES. You get the idea.

> Finally, I managed to enable strdup on OS400 (it exists, but only for
> C++: you have to define a special symbol to enable strcmpi(), strdup(),
> etc for C). I think it's the cleaner solution.

The above option would keep you in C territory ;-)

> By the way: if OS400 was the one an only platform without strdup(),
> would'nt it be time to suppress "HAVE_STRDUP" and assume it is always
> there ?

If memory serves me, long time ago Dan Fandrich also had some
platforms without strdup.

Cheers,

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