summaryrefslogtreecommitdiff
path: root/libiberty/xstrdup.c
blob: 9d08bc704055d781ebc9c96b9ceb47e6cfc3012e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* 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"

char *
xstrdup (s)
     const char *s;
{
  char *ret;

  ret = xmalloc (strlen (s) + 1);
  strcpy (ret, s);
  return ret;
}