diff options
author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-04-02 20:28:00 +0000 |
---|---|---|
committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-04-02 20:28:00 +0000 |
commit | 943c390afbced1e5f3f4c7018127fa19ecff8410 (patch) | |
tree | ccbc1d31f63aab96feed83ed20694f25d407b688 /libiberty/bcopy.c | |
parent | 8e1547dab871e31b3a75cc1c172b47728ed8e210 (diff) | |
download | gcc-943c390afbced1e5f3f4c7018127fa19ecff8410.tar.gz |
* bcmp.c: Fix warnings and implement using memcmp.
* bcopy.c: Fix warnings.
* bzero.c: Fix warnings and implement using memset.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97457 138bc75d-0d04-0410-961f-82ee72b054a4
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 09442474645..1e2eca9c641 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--; } } |