1 /* xstrdup.c -- Duplicate a string in memory, using xmalloc.
2 This trivial function is in the public domain.
3 Ian Lance Taylor, Cygnus Support, December 1995. */
7 @deftypefn Replacement char* xstrdup (const char *@var{s})
9 Duplicates a character string without fail, using @code{xmalloc} to
19 #include <sys/types.h>
23 # ifdef HAVE_STRINGS_H
28 #include "libiberty.h"
31 xstrdup (const char *s
)
33 register size_t len
= strlen (s
) + 1;
34 register char *ret
= XNEWVEC (char, len
);
35 return (char *) memcpy (ret
, s
, len
);
This page took 0.064277 seconds and 4 git commands to generate.