diff options
author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-25 04:05:12 +0000 |
---|---|---|
committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-25 04:05:12 +0000 |
commit | 1cf8f41f58e597554a1f73d904c49bf12d71419e (patch) | |
tree | 5755195d1ce674183bfde67ec9b821bff117374f /libiberty | |
parent | 27e1789b96851c0b936564b990ba28752dbc7e4a (diff) | |
download | gcc-1cf8f41f58e597554a1f73d904c49bf12d71419e.tar.gz |
* xmemdup.c, xstrdup.c: Expose the tail call.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97033 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/ChangeLog | 4 | ||||
-rw-r--r-- | libiberty/xmemdup.c | 7 | ||||
-rw-r--r-- | libiberty/xstrdup.c | 7 |
3 files changed, 14 insertions, 4 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 0ab2ec9abf9..231bab3897d 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,7 @@ +2005-03-24 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * xmemdup.c, xstrdup.c: Expose the tail call. + 2005-03-09 Mark Mitchell <mark@codesourcery.com> * configure.ac (funcs): Add gettimeofday. diff --git a/libiberty/xmemdup.c b/libiberty/xmemdup.c index 9e9d66b715d..0dae37d8923 100644 --- a/libiberty/xmemdup.c +++ b/libiberty/xmemdup.c @@ -24,6 +24,10 @@ allocated, the remaining memory is zeroed. #include <sys/types.h> /* For size_t. */ #ifdef HAVE_STRING_H #include <string.h> +#else +# ifdef HAVE_STRINGS_H +# include <strings.h> +# endif #endif PTR @@ -33,6 +37,5 @@ xmemdup (input, copy_size, alloc_size) size_t alloc_size; { PTR output = xcalloc (1, alloc_size); - memcpy (output, input, copy_size); - return output; + return (PTR) memcpy (output, input, copy_size); } diff --git a/libiberty/xstrdup.c b/libiberty/xstrdup.c index 5aa084a7687..5ddd2e98a93 100644 --- a/libiberty/xstrdup.c +++ b/libiberty/xstrdup.c @@ -19,6 +19,10 @@ 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" @@ -29,6 +33,5 @@ xstrdup (s) { register size_t len = strlen (s) + 1; register char *ret = xmalloc (len); - memcpy (ret, s, len); - return ret; + return (char *) memcpy (ret, s, len); } |