summaryrefslogtreecommitdiff
path: root/sys/src/9/port/chan.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-08-08 16:44:41 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2014-08-08 16:44:41 +0200
commitee6409366ed63e37adaaf4e479eeb335df83a63e (patch)
tree7e9fadbcde966c3fccbd279225da542d80f90d36 /sys/src/9/port/chan.c
parent0ceeee4c8b207b3833e005643abf8997a60c255f (diff)
kernel: use nil for pointers instead of 0, zero channel umc and dirrock in newchan()
Diffstat (limited to 'sys/src/9/port/chan.c')
-rw-r--r--sys/src/9/port/chan.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/sys/src/9/port/chan.c b/sys/src/9/port/chan.c
index 23085cb0a..0ce591b8e 100644
--- a/sys/src/9/port/chan.c
+++ b/sys/src/9/port/chan.c
@@ -250,16 +250,20 @@ newchan(void)
c->offset = 0;
c->devoffset = 0;
c->iounit = 0;
- c->umh = 0;
+ c->umh = nil;
+ c->umc = nil;
c->uri = 0;
c->dri = 0;
- c->aux = 0;
- c->mchan = 0;
- c->mcp = 0;
- c->mux = 0;
- memset(&c->mqid, 0, sizeof(c->mqid));
- c->path = 0;
+ c->dirrock = nil;
+ c->nrock = 0;
+ c->mrock = 0;
c->ismtpt = 0;
+ c->mcp = nil;
+ c->mux = nil;
+ c->aux = nil;
+ c->mchan = nil;
+ memset(&c->mqid, 0, sizeof(c->mqid));
+ c->path = nil;
return c;
}
@@ -444,7 +448,7 @@ chanfree(Chan *c)
if(c->dirrock != nil){
free(c->dirrock);
- c->dirrock = 0;
+ c->dirrock = nil;
c->nrock = 0;
c->mrock = 0;
}
@@ -868,8 +872,7 @@ cclone(Chan *c)
error("clone failed");
nc = wq->clone;
free(wq);
- nc->path = c->path;
- if(c->path)
+ if((nc->path = c->path) != nil)
incref(c->path);
return nc;
}
@@ -924,7 +927,7 @@ domount(Chan **cp, Mhead **mp, Path **path)
if(findmount(cp, mp, (*cp)->type, (*cp)->dev, (*cp)->qid) == 0)
return 0;
- if(path){
+ if(path != nil){
p = *path;
p = uniquepath(p);
if(p->mlen <= 0)