]> gcc.gnu.org Git - gcc.git/blame - libiberty/xstrdup.c
cpphash.h (struct _cpp_buff, [...]): New.
[gcc.git] / libiberty / xstrdup.c
CommitLineData
6599da04
JM
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
df548dfc 5#include <sys/types.h>
7e4311a3
KG
6#ifdef HAVE_CONFIG_H
7#include "config.h"
8#endif
9#ifdef HAVE_STRING_H
10#include <string.h>
11#endif
6599da04
JM
12#include "ansidecl.h"
13#include "libiberty.h"
14
15char *
16xstrdup (s)
7e4311a3 17 const char *s;
6599da04 18{
7e4311a3
KG
19 register size_t len = strlen (s) + 1;
20 register char *ret = xmalloc (len);
21 memcpy (ret, s, len);
6599da04
JM
22 return ret;
23}
This page took 0.222523 seconds and 5 git commands to generate.