bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] Add strdup.h.


From: Simon Josefsson
Subject: Re: [Bug-gnulib] Add strdup.h.
Date: Fri, 23 Jan 2004 09:21:04 +0100 (CET)
User-agent: SquirrelMail/1.5.0 [CVS]

> Simon Josefsson <address@hidden> writes:
>
>> --- /dev/null        1 Jan 1970 00:00:00 -0000
>> +++ strdup.h 18 Jan 2004 07:54:34 -0000
>> @@ -0,0 +1,2 @@
>> +/* Duplicate S, returning an identical malloc'd string.  */
>> +char *strdup (const char *s);
>
> This doesn't loook portable, since many implementations define strdup
> as a macro in <string.h> (which they are entitled to do).  Also, some
> older implementations (not conforming to POSIX 2001) define a
> prototype where strdup takes a char * argument, not char const *.
>
> It should probably look something like this instead:
>
> #include <string.h>
> #if ! HAVE_DECL_STRDUP && ! defined strdup
> char *strdup (char const *s);
> #endif
>
> with the appropriate changes to strdup.m4.

Yes, thanks.  I didn't test it. How about this version?

Attachment: strdup-h.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]