[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: pkgsrc/devel/generate
On Tue, 20 May 2008 20:58:36 +0200
Joerg Sonnenberger <joerg%britannica.bec.de@localhost> wrote:
> On Tue, May 20, 2008 at 06:53:16PM +0000, D'Arcy J.M. Cain wrote:
> > Log Message:
> > Update to 2.5.
> > Uses internal version of strdup (my_strdup) rather than depending on
> > availability in all systems. Fixes Linux bulk build.
> Are you sure this isn't some random _POSIX_SOURCE or so?
> On the other hand, glibc...
I thought of all that but given how simple the code for strdup is I
just went for the easy approach. In fact, I forgot to mention that
doing it the way I do also allows me to check for memory allocation and
exit the program if it fails so the code is slightly more robust this
way. Consider how simple this code is.
static char *
my_strdup(const char *string)
if (!(nstr = malloc(strlen(string) + 1)))
fatal("Can't allocate memory for string \"%s\"\n", string);
return strcpy(nstr, string);
D'Arcy J.M. Cain <darcy%NetBSD.org@localhost>
Main Index |
Thread Index |