diff options
author | rsc <rsc> | 2007-08-10 17:17:42 +0000 |
---|---|---|
committer | rsc <rsc> | 2007-08-10 17:17:42 +0000 |
commit | dca5b5ca2e3687f27ebf589fe3855966932840d8 (patch) | |
tree | 79be03b3d6f950eb8ceb105449674aaa614bd17e /string.c | |
parent | 6861140a667cd7219cf9bc1e051faadfc8c46c6f (diff) | |
download | xv6-labs-dca5b5ca2e3687f27ebf589fe3855966932840d8.tar.gz xv6-labs-dca5b5ca2e3687f27ebf589fe3855966932840d8.tar.bz2 xv6-labs-dca5b5ca2e3687f27ebf589fe3855966932840d8.zip |
avoid assignments in declarations
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -4,8 +4,9 @@ void* memset(void *dst, int c, uint n) { - char *d = (char*) dst; + char *d; + d = (char*)dst; while(n-- > 0) *d++ = c; @@ -15,12 +16,13 @@ memset(void *dst, int c, uint n) int memcmp(const void *v1, const void *v2, uint n) { - const uchar *s1 = (const uchar*) v1; - const uchar *s2 = (const uchar*) v2; - + const uchar *s1, *s2; + + s1 = v1; + s2 = v2; while(n-- > 0) { if(*s1 != *s2) - return (int) *s1 - (int) *s2; + return *s1 - *s2; s1++, s2++; } |