Explicitly compare pointers with NULL rather than treating a pointer as

a boolean directly, use NULL instead of 0.
This commit is contained in:
Robert Watson 2004-04-04 19:13:35 +00:00
parent 37a35e4a60
commit 2a8021f14b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127851
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);