]> git.ipfire.org Git - thirdparty/gcc.git/blob - libiberty/xstrdup.c
Initial revision
[thirdparty/gcc.git] / libiberty / xstrdup.c
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. */
4
5 #include "ansidecl.h"
6 #include "libiberty.h"
7
8 char *
9 xstrdup (s)
10 const char *s;
11 {
12 char *ret;
13
14 ret = xmalloc (strlen (s) + 1);
15 strcpy (ret, s);
16 return ret;
17 }