diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2017-05-31 21:49:53 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2017-05-31 21:49:53 +0200 |
commit | c1c2b3082caeed8f7c1dfa9d7e303d650e2650b3 (patch) | |
tree | 78d165b0375e7886a11c3e673a4b120aead11d7a | |
parent | 4cde17a22f8346a48602be4f63f2993c167c4edf (diff) | |
download | abaos-c1c2b3082caeed8f7c1dfa9d7e303d650e2650b3.tar.gz abaos-c1c2b3082caeed8f7c1dfa9d7e303d650e2650b3.tar.bz2 |
memmove cleanup
-rw-r--r-- | src/string.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/string.c b/src/string.c index ef0d6f7..8d4f876 100644 --- a/src/string.c +++ b/src/string.c @@ -17,14 +17,16 @@ void *memmove( void *d, const void *s, size_t n ) if( dd == ss ) return d; if( dd <= ss ) { - while( n-- > 0 ) { + while( n > 0 ) { *dd++ = *ss++; + n--; } } else { dd += n; ss += n; - while( n-- > 0 ) { + while( n > 0 ) { *--dd = *--ss; + n--; } } |