Explicitly compare pointers with NULL rather than treating a pointer as

a boolean directly, use NULL instead of 0.
This commit is contained in:
rwatson 2004-04-04 19:13:35 +00:00
parent 207a24b737
commit dcbc251be5
2 changed files with 9 additions and 6 deletions

View File

@ -434,7 +434,8 @@ nfsrv_rcv(struct socket *so, void *arg, int waitflag)
* to an nfsd so that there is feedback to the TCP layer that
* the nfs servers are heavily loaded.
*/
if (STAILQ_FIRST(&slp->ns_rec) && waitflag == M_DONTWAIT) {
if (STAILQ_FIRST(&slp->ns_rec) != NULL &&
waitflag == M_DONTWAIT) {
slp->ns_flag |= SLP_NEEDQ;
goto dorecs;
}
@ -512,8 +513,8 @@ nfsrv_rcv(struct socket *so, void *arg, int waitflag)
*/
dorecs:
if (waitflag == M_DONTWAIT &&
(STAILQ_FIRST(&slp->ns_rec)
|| (slp->ns_flag & (SLP_NEEDQ | SLP_DISCONN))))
(STAILQ_FIRST(&slp->ns_rec) != NULL ||
(slp->ns_flag & (SLP_NEEDQ | SLP_DISCONN))))
nfsrv_wakenfsd(slp);
}
@ -662,7 +663,8 @@ nfsrv_dorec(struct nfssvc_sock *slp, struct nfsd *nfsd,
int error;
*ndp = NULL;
if ((slp->ns_flag & SLP_VALID) == 0 || !STAILQ_FIRST(&slp->ns_rec))
if ((slp->ns_flag & SLP_VALID) == 0 ||
STAILQ_FIRST(&slp->ns_rec) == NULL)
return (ENOBUFS);
rec = STAILQ_FIRST(&slp->ns_rec);
STAILQ_REMOVE_HEAD(&slp->ns_rec, nr_link);

View File

@ -336,7 +336,7 @@ nfssvc_nfsd(struct thread *td)
break;
}
}
if (slp == 0)
if (slp == NULL)
nfsd_head_flag &= ~NFSD_CHECKSLP;
}
if ((slp = nfsd->nfsd_slp) == NULL)
@ -652,7 +652,8 @@ nfsrv_init(int terminating)
panic("nfsd init");
nfssvc_sockhead_flag |= SLP_INIT;
if (terminating) {
for (slp = TAILQ_FIRST(&nfssvc_sockhead); slp != 0; slp = nslp){
for (slp = TAILQ_FIRST(&nfssvc_sockhead); slp != NULL;
slp = nslp) {
nslp = TAILQ_NEXT(slp, ns_chain);
if (slp->ns_flag & SLP_VALID)
nfsrv_zapsock(slp);