[Top][All Lists]

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

recommend strdup or strdup-posix?

From: Simon Josefsson
Subject: recommend strdup or strdup-posix?
Date: Sat, 29 Jan 2011 11:33:28 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux)

I was using strdup and it triggered this warning in gnulib:

  _GL_WARN_ON_USE (strdup, "strdup is unportable - "
                   "use gnulib module strdup for portability");

However the strdup module is deprecated according to modules/strdup:

  This module is obsolete. But you may want to use the strdup-posix module.

So string.h should probably point to strdup-posix?

But what is the purpose of the strdup module then?  According to


the difference is that strdup-posix also sets errno correctly on mingw
but the strdup module does not fix that bug.

Can't we just rename strdup-posix to strdup?

If the dependency on malloc-posix module is the problem, strdup.c could
easily set errno itself if it gets a NULL back from malloc, couldn't it?

I suspect strdup is one of the initial modules a new gnulib user would
import, so this complexity might be confusing and I don't see the gain.


reply via email to

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