diff options
author | DJ Delorie <dj@redhat.com> | 2005-04-03 04:41:10 +0000 |
---|---|---|
committer | DJ Delorie <dj@redhat.com> | 2005-04-03 04:41:10 +0000 |
commit | 14a88c496bef288d66f245d1d07c7bfa7f6062fb (patch) | |
tree | ad4d2c6176db68eb7d06ff8fb67d55395c581e49 /libiberty/bcopy.c | |
parent | 26dae57f146e8b7d546a90c4317389281eb879e7 (diff) | |
download | gdb-14a88c496bef288d66f245d1d07c7bfa7f6062fb.zip gdb-14a88c496bef288d66f245d1d07c7bfa7f6062fb.tar.gz gdb-14a88c496bef288d66f245d1d07c7bfa7f6062fb.tar.bz2 |
merge from gcc
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--; } } |