summaryrefslogtreecommitdiff
path: root/pipe.c
diff options
context:
space:
mode:
authorRuss Cox <[email protected]>2011-01-11 13:01:13 -0500
committerRuss Cox <[email protected]>2011-01-11 13:01:13 -0500
commit1a81e38b17144624415d252a521fd5a06079d681 (patch)
treeea7d895bcf77aa25861c09ee490488b6f729e0f3 /pipe.c
parent240679608cd46649d1144408f28f83141f9f3a86 (diff)
downloadxv6-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 'pipe.c')
-rw-r--r--pipe.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pipe.c b/pipe.c
index bc847b9..f76ed5c 100644
--- a/pipe.c
+++ b/pipe.c
@@ -66,7 +66,7 @@ pipeclose(struct pipe *p, int writable)
p->readopen = 0;
wakeup(&p->nwrite);
}
- if(p->readopen == 0 && p->writeopen == 0) {
+ if(p->readopen == 0 && p->writeopen == 0){
release(&p->lock);
kfree((char*)p);
} else
@@ -81,7 +81,7 @@ pipewrite(struct pipe *p, char *addr, int n)
acquire(&p->lock);
for(i = 0; i < n; i++){
- while(p->nwrite == p->nread + PIPESIZE) { //DOC: pipewrite-full
+ while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
if(p->readopen == 0 || proc->killed){
release(&p->lock);
return -1;