diff options
| author | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-10-27 02:55:18 +0000 |
|---|---|---|
| committer | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-10-27 02:55:18 +0000 |
| commit | 501aeb540a2ec1faf68893c0c70c3520109242a9 (patch) | |
| tree | 896ec25a6f12877c36ce5f89cdca36be1e98f81e /missing/memmove.c | |
| parent | d0d89f93c70cff3dec1d7d25453ab9b8756db4da (diff) | |
| download | ruby-501aeb540a2ec1faf68893c0c70c3520109242a9.tar.gz ruby-501aeb540a2ec1faf68893c0c70c3520109242a9.tar.xz ruby-501aeb540a2ec1faf68893c0c70c3520109242a9.zip | |
* missing.h, missing/memcmp.c, missing/memmove.c:
ANSI compatible interface.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'missing/memmove.c')
| -rw-r--r-- | missing/memmove.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/missing/memmove.c b/missing/memmove.c index c9d67d8b4..19c5f1884 100644 --- a/missing/memmove.c +++ b/missing/memmove.c @@ -1,22 +1,21 @@ /* public domain rewrite of memcmp(3) */ +#include <stddef.h> + void * -memmove (d, s, n) - void *d, *s; - int n; +memmove(void *d, const void *s, size_t n) { - char *dst = d; - char *src = s; - void *ret = dst; + char *dst = (char *)d; + const char *src = (const char *)s; if (src < dst) { src += n; dst += n; - while (n--) + for (; n; --n) *--dst = *--src; } else if (dst < src) - while (n--) + for (; n; --n) *dst++ = *src++; - return ret; + return d; } |
