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 /ulib.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 'ulib.c')
-rw-r--r-- | ulib.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -31,7 +31,8 @@ strcmp(const char *p, const char *q) uint strlen(char *s) { - int n = 0; + int n; + for(n = 0; s[n]; n++) ; return n; @@ -40,11 +41,11 @@ strlen(char *s) void* memset(void *dst, int c, uint n) { - char *d = (char*) dst; - + char *d; + + d = dst; while(n-- > 0) *d++ = c; - return dst; } @@ -60,10 +61,10 @@ strchr(const char *s, char c) char* gets(char *buf, int max) { - int i = 0, cc; + int i, cc; char c; - while(i+1 < max){ + for(i=0; i+1 < max; ){ cc = read(0, &c, 1); if(cc < 1) break; |