cURL / Mailing Lists / curl-library / Single Mail

curl-library

Lack of strdup

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Mon, 10 Jul 2006 16:13:55 -0700

I'm trying to compile curl for eCos but am running into a snag in that
eCos doesn't support strdup(). Curl actually has some code to support
Ultrix, which is also missing strdup, but I suspect curl development
has advanced such that the Ultrix support no longer works. Even if it
does still work there, strdup() is not defined in libcurl which means
that any application that uses libcurl must define its own version.

I'd like to fix this so it's done properly. On first blush, creating
a function curlx_strdup in strdup.c and and putting a prototype into
strdup.h which is loaded by curlx.h seems like the right way. Of course,
nobody wants to use curlx_strdup when strdup is the natural and expected
way of using the function, so somewhere will need to be a "#define
strdup curlx_strdup". Putting it into strdup.h seems a bit "surprising"
to the user, plus it requires lots of modules to suddenly need to load
it when on most platforms it isn't necessary. I'm tempted to place the
define into setup.h (both of them) so it just works everywhere.

Another complication is that the memory debug subsystem #defines its own
version of strdup, as does WinCE. Any suggestions?

>>> Dan
Received on 2006-07-11