diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 2005-04-02 20:28:00 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 2005-04-02 20:28:00 +0000 |
commit | 291387970dce86f883234b18735efd65463c4044 (patch) | |
tree | ccbc1d31f63aab96feed83ed20694f25d407b688 /libiberty/bcopy.c | |
parent | f9a9ac80d6a6b5a8e7d64d3d0c81e95fb0003238 (diff) | |
download | gcc-291387970dce86f883234b18735efd65463c4044.zip gcc-291387970dce86f883234b18735efd65463c4044.tar.gz gcc-291387970dce86f883234b18735efd65463c4044.tar.bz2 |
bcmp.c: Fix warnings and implement using memcmp.
* bcmp.c: Fix warnings and implement using memcmp.
* bcopy.c: Fix warnings.
* bzero.c: Fix warnings and implement using memset.
From-SVN: r97457
Diffstat (limited to 'libiberty/bcopy.c')
-rw-r--r-- | libiberty/bcopy.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libiberty/bcopy.c b/libiberty/bcopy.c index 0944247..1e2eca9 100644 --- a/libiberty/bcopy.c +++ b/libiberty/bcopy.c @@ -9,17 +9,23 @@ Copies @var{length} bytes from memory region @var{in} to region */ +#include <stddef.h> + void -bcopy (register char *src, register char *dest, int len) +bcopy (const void *src, void *dest, size_t len) { if (dest < src) - while (len--) - *dest++ = *src++; + { + const char *firsts = src; + char *firstd = dest; + while (len--) + *firstd++ = *firsts++; + } else { - char *lasts = src + (len-1); - char *lastd = dest + (len-1); + const char *lasts = (const char *)src + (len-1); + char *lastd = (char *)dest + (len-1); while (len--) - *(char *)lastd-- = *(char *)lasts--; + *lastd-- = *lasts--; } } |