diff options
author | dim <dim@FreeBSD.org> | 2010-10-21 19:11:14 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2010-10-21 19:11:14 +0000 |
commit | 844d5c9852c83cc56dccdc017c27f2bfc0928f05 (patch) | |
tree | 506464413c40d2c6a4a46d04892a9415cb886522 /contrib/binutils/libiberty/xstrdup.c | |
parent | acc1b913a3297e19f9ffe7d2b7b8a3142926d3b4 (diff) | |
parent | 0acbbeece75076693a5c54ce4d376aa9f021b4e3 (diff) | |
download | FreeBSD-src-844d5c9852c83cc56dccdc017c27f2bfc0928f05.zip FreeBSD-src-844d5c9852c83cc56dccdc017c27f2bfc0928f05.tar.gz |
Merge ^vendor/binutils/dist@214082 into contrib/binutils.
Diffstat (limited to 'contrib/binutils/libiberty/xstrdup.c')
-rw-r--r-- | contrib/binutils/libiberty/xstrdup.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/contrib/binutils/libiberty/xstrdup.c b/contrib/binutils/libiberty/xstrdup.c index 5aa084a..9ac2ea0 100644 --- a/contrib/binutils/libiberty/xstrdup.c +++ b/contrib/binutils/libiberty/xstrdup.c @@ -19,16 +19,18 @@ obtain memory. #endif #ifdef HAVE_STRING_H #include <string.h> +#else +# ifdef HAVE_STRINGS_H +# include <strings.h> +# endif #endif #include "ansidecl.h" #include "libiberty.h" char * -xstrdup (s) - const char *s; +xstrdup (const char *s) { register size_t len = strlen (s) + 1; - register char *ret = xmalloc (len); - memcpy (ret, s, len); - return ret; + register char *ret = XNEWVEC (char, len); + return (char *) memcpy (ret, s, len); } |