From f2aa1787257bad51adbb1ad25ac2117dc6e1f9fe Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Mon, 22 Mar 2004 03:57:01 +0000 Subject: [PATCH] Compare pointers with NULL rather than 0, or treating them as boolans in if statements. at_rmx gets a $FreeBSD$ out of the deal also (this code appears to be unused). --- sys/netatalk/aarp.c | 10 +++++----- sys/netatalk/at_control.c | 4 ++-- sys/netatalk/at_rmx.c | 3 ++- sys/netatalk/ddp_input.c | 4 ++-- sys/netatalk/ddp_pcb.c | 2 +- sys/netatalk/ddp_usrreq.c | 4 ++-- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/sys/netatalk/aarp.c b/sys/netatalk/aarp.c index b789d3a5e186..18b47e7cdb4c 100644 --- a/sys/netatalk/aarp.c +++ b/sys/netatalk/aarp.c @@ -39,7 +39,7 @@ static struct aarptab aarptab[AARPTAB_SIZE]; #define AARPTAB_HASH(a) \ ((((a).s_net << 8) + (a).s_node) % AARPTAB_NB) -#define AARPTAB_LOOK(aat,addr) { \ +#define AARPTAB_LOOK(aat, addr) { \ int n; \ aat = &aarptab[ AARPTAB_HASH(addr) * AARPTAB_BSIZ ]; \ for (n = 0; n < AARPTAB_BSIZ; n++, aat++) \ @@ -47,7 +47,7 @@ static struct aarptab aarptab[AARPTAB_SIZE]; aat->aat_ataddr.s_node == (addr).s_node) \ break; \ if (n >= AARPTAB_BSIZ) \ - aat = 0; \ + aat = NULL; \ } #define AARPT_AGE (60 * 1) @@ -233,9 +233,9 @@ aarpresolve(ac, m, destsat, desten) s = splimp(); AARPTAB_LOOK(aat, destsat->sat_addr); - if (aat == 0) { /* No entry */ + if (aat == NULL) { /* No entry */ aat = aarptnew(&destsat->sat_addr); - if (aat == 0) { + if (aat == NULL) { panic("aarpresolve: no free entry"); } aat->aat_hold = m; @@ -391,7 +391,7 @@ at_aarpinput(struct arpcom *ac, struct mbuf *m) } AARPTAB_LOOK(aat, spa); - if (aat) { + if (aat != NULL) { if (op == AARPOP_PROBE) { /* * Someone's probing for spa, dealocate the one we've got, diff --git a/sys/netatalk/at_control.c b/sys/netatalk/at_control.c index 2a61d6316ed9..22dc1f2b7ef4 100644 --- a/sys/netatalk/at_control.c +++ b/sys/netatalk/at_control.c @@ -56,7 +56,7 @@ at_control(struct socket *so, u_long cmd, caddr_t data, /* * If we have an ifp, then find the matching at_ifaddr if it exists */ - if (ifp) { + if (ifp != NULL) { for (aa = at_ifaddr; aa; aa = aa->aa_next) { if (aa->aa_ifp == ifp) break; } @@ -554,7 +554,7 @@ at_ifinit(ifp, aa, sat) * Now that we have selected an address, we need to tell the interface * about it, just in case it needs to adjust something. */ - if (ifp->if_ioctl && + if (ifp->if_ioctl != NULL&& (error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)aa))) { /* * of course this could mean that it objects violently diff --git a/sys/netatalk/at_rmx.c b/sys/netatalk/at_rmx.c index ca8db3aff5db..ab0353682f23 100644 --- a/sys/netatalk/at_rmx.c +++ b/sys/netatalk/at_rmx.c @@ -27,6 +27,7 @@ * SUCH DAMAGE. * * at_rmx.c,v 1.13 1995/05/30 08:09:31 rgrimes Exp + * $FreeBSD$ */ /* This code generates debugging traces to the radix code */ @@ -47,7 +48,7 @@ prsockaddr(void *v) char *bp = &hexbuf[0]; u_char *cp = v; - if (v) { + if (v != NULL) { int len = *cp; u_char *cplim = cp + len; diff --git a/sys/netatalk/ddp_input.c b/sys/netatalk/ddp_input.c index 69a15acd9f1a..fe9f4d47da88 100644 --- a/sys/netatalk/ddp_input.c +++ b/sys/netatalk/ddp_input.c @@ -95,7 +95,7 @@ ddp_input(m, ifp, elh, phase) bzero((caddr_t)&from, sizeof(struct sockaddr_at)); bzero((caddr_t)&to, sizeof(struct sockaddr_at)); - if (elh) { + if (elh != NULL) { /* * Extract the information in the short header. * netowrk information is defaulted to ATADDR_ANYNET @@ -345,7 +345,7 @@ ddp_input(m, ifp, elh, phase) * We are no longer interested in the link layer. * so cut it off. */ - if (elh) { + if (elh != NULL) { m_adj(m, sizeof(struct ddpshdr)); } else { if (ddp_cksum && cksum && cksum != at_cksum(m, sizeof(int))) { diff --git a/sys/netatalk/ddp_pcb.c b/sys/netatalk/ddp_pcb.c index 4ee48d50e80e..c4f742889111 100644 --- a/sys/netatalk/ddp_pcb.c +++ b/sys/netatalk/ddp_pcb.c @@ -239,7 +239,7 @@ at_pcballoc(struct socket *so) ddp->ddp_prev = NULL; ddp->ddp_pprev = NULL; ddp->ddp_pnext = NULL; - if (ddpcb) { + if (ddpcb != NULL) { ddpcb->ddp_prev = ddp; } ddpcb = ddp; diff --git a/sys/netatalk/ddp_usrreq.c b/sys/netatalk/ddp_usrreq.c index 490d907bba9c..b8f68aa17f2a 100644 --- a/sys/netatalk/ddp_usrreq.c +++ b/sys/netatalk/ddp_usrreq.c @@ -159,7 +159,7 @@ ddp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, return (EINVAL); } - if (addr) { + if (addr != NULL) { if (ddp->ddp_fsat.sat_port != ATADDR_ANYPORT) { return (EISCONN); } @@ -178,7 +178,7 @@ ddp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, s = splnet(); error = ddp_output(m, so); - if (addr) { + if (addr != NULL) { at_pcbdisconnect(ddp); } splx(s);