* xstrdup.c (xstrdup): Switch from strcpy to memcpy for speed.
From-SVN: r24651
This commit is contained in:
parent
efd59a3308
commit
7e4311a31b
@ -1,3 +1,7 @@
|
|||||||
|
Wed Jan 13 14:16:36 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
|
* xstrdup.c (xstrdup): Switch from strcpy to memcpy for speed.
|
||||||
|
|
||||||
Tue Dec 22 09:43:35 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
Tue Dec 22 09:43:35 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
* argv.c (buildargv): Cast the result of alloca in assignment.
|
* argv.c (buildargv): Cast the result of alloca in assignment.
|
||||||
|
@ -2,16 +2,21 @@
|
|||||||
This trivial function is in the public domain.
|
This trivial function is in the public domain.
|
||||||
Ian Lance Taylor, Cygnus Support, December 1995. */
|
Ian Lance Taylor, Cygnus Support, December 1995. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
#include "ansidecl.h"
|
#include "ansidecl.h"
|
||||||
#include "libiberty.h"
|
#include "libiberty.h"
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xstrdup (s)
|
xstrdup (s)
|
||||||
const char *s;
|
const char *s;
|
||||||
{
|
{
|
||||||
char *ret;
|
register size_t len = strlen (s) + 1;
|
||||||
|
register char *ret = xmalloc (len);
|
||||||
ret = xmalloc (strlen (s) + 1);
|
memcpy (ret, s, len);
|
||||||
strcpy (ret, s);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user