diff options
author | Russ Cox <[email protected]> | 2011-01-11 13:01:13 -0500 |
---|---|---|
committer | Russ Cox <[email protected]> | 2011-01-11 13:01:13 -0500 |
commit | 1a81e38b17144624415d252a521fd5a06079d681 (patch) | |
tree | ea7d895bcf77aa25861c09ee490488b6f729e0f3 /syscall.c | |
parent | 240679608cd46649d1144408f28f83141f9f3a86 (diff) | |
download | xv6-labs-1a81e38b17144624415d252a521fd5a06079d681.tar.gz xv6-labs-1a81e38b17144624415d252a521fd5a06079d681.tar.bz2 xv6-labs-1a81e38b17144624415d252a521fd5a06079d681.zip |
make new code like old code
Variable declarations at top of function,
separate from initialization.
Use == 0 instead of ! for checking pointers.
Consistent spacing around {, *, casts.
Declare 0-parameter functions as (void) not ().
Integer valued functions return -1 on failure, 0 on success.
Diffstat (limited to 'syscall.c')
-rw-r--r-- | syscall.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -32,8 +32,8 @@ fetchstr(struct proc *p, uint addr, char **pp) if(addr >= p->sz) return -1; - *pp = (char *) addr; - ep = (char *) p->sz; + *pp = (char*)addr; + ep = (char*)p->sz; for(s = *pp; s < ep; s++) if(*s == 0) return s - *pp; @@ -44,8 +44,7 @@ fetchstr(struct proc *p, uint addr, char **pp) int argint(int n, int *ip) { - int x = fetchint(proc, proc->tf->esp + 4 + 4*n, ip); - return x; + return fetchint(proc, proc->tf->esp + 4 + 4*n, ip); } // Fetch the nth word-sized system call argument as a pointer @@ -60,7 +59,7 @@ argptr(int n, char **pp, int size) return -1; if((uint)i >= proc->sz || (uint)i+size >= proc->sz) return -1; - *pp = (char *) i; + *pp = (char*)i; return 0; } |