summaryrefslogtreecommitdiff
path: root/ulib.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 /ulib.c
parent6861140a667cd7219cf9bc1e051faadfc8c46c6f (diff)
downloadxv6-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.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ulib.c b/ulib.c
index 994ceb9..6c57b2d 100644
--- a/ulib.c
+++ b/ulib.c
@@ -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;