X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=libiberty%2Fxstrdup.c;fp=libiberty%2Fxstrdup.c;h=fa12c96a3cd61e8f7ca919d3dd3ef74989871e3b;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=5aa084a768791c413d9405da227fa6f317ec6524;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git diff --git a/libiberty/xstrdup.c b/libiberty/xstrdup.c index 5aa084a7..fa12c96a 100644 --- a/libiberty/xstrdup.c +++ b/libiberty/xstrdup.c @@ -13,22 +13,24 @@ obtain memory. */ -#include #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include #ifdef HAVE_STRING_H #include +#else +# ifdef HAVE_STRINGS_H +# include +# 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); }