1997-09-24 19:39:15 +04:00
|
|
|
/* xstrdup.c -- Duplicate a string in memory, using xmalloc.
|
|
|
|
This trivial function is in the public domain.
|
|
|
|
Ian Lance Taylor, Cygnus Support, December 1995. */
|
|
|
|
|
|
|
|
#include "ansidecl.h"
|
|
|
|
#include "libiberty.h"
|
|
|
|
|
1997-10-25 05:57:10 +04:00
|
|
|
#include <string.h>
|
|
|
|
|
1997-09-24 19:39:15 +04:00
|
|
|
char *
|
|
|
|
xstrdup (s)
|
|
|
|
const char *s;
|
|
|
|
{
|
|
|
|
char *ret;
|
|
|
|
|
|
|
|
ret = xmalloc (strlen (s) + 1);
|
|
|
|
strcpy (ret, s);
|
|
|
|
return ret;
|
|
|
|
}
|