summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorrsc <rsc>2007-08-10 17:17:42 +0000
committerrsc <rsc>2007-08-10 17:17:42 +0000
commitdca5b5ca2e3687f27ebf589fe3855966932840d8 (patch)
tree79be03b3d6f950eb8ceb105449674aaa614bd17e /string.c
parent6861140a667cd7219cf9bc1e051faadfc8c46c6f (diff)
downloadxv6-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.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/string.c b/string.c
index dc73266..a871b68 100644
--- a/string.c
+++ b/string.c
@@ -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++;
}