diff options
author | Andre Oppermann <andre@FreeBSD.org> | 2004-08-11 10:46:15 +0000 |
---|---|---|
committer | Andre Oppermann <andre@FreeBSD.org> | 2004-08-11 10:46:15 +0000 |
commit | 0b17fba7bc072f1ad8b739d53d3e957e270d9377 (patch) | |
tree | 62ec197049dc91a6914c64a56582a7553926b106 /sys | |
parent | de2e5d1e20e4373e8f14cde90bb0684e419b0773 (diff) | |
download | src-0b17fba7bc072f1ad8b739d53d3e957e270d9377.tar.gz src-0b17fba7bc072f1ad8b739d53d3e957e270d9377.zip |
Consistently use NULL for pointer comparisons.
Notes
Notes:
svn path=/head/; revision=133481
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/ip_input.c | 22 | ||||
-rw-r--r-- | sys/netinet/ip_output.c | 20 |
2 files changed, 21 insertions, 21 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 3bb82776ad63..61db043867b2 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -343,7 +343,7 @@ ip_input(struct mbuf *m) goto tooshort; if (m->m_len < sizeof (struct ip) && - (m = m_pullup(m, sizeof (struct ip))) == 0) { + (m = m_pullup(m, sizeof (struct ip))) == NULL) { ipstat.ips_toosmall++; return; } @@ -360,7 +360,7 @@ ip_input(struct mbuf *m) goto bad; } if (hlen > m->m_len) { - if ((m = m_pullup(m, hlen)) == 0) { + if ((m = m_pullup(m, hlen)) == NULL) { ipstat.ips_badhlen++; return; } @@ -1366,7 +1366,7 @@ ip_dooptions(struct mbuf *m, int pass, struct sockaddr_in *next_hop) ipaddr.sin_addr = ip->ip_dst; ia = (struct in_ifaddr *) ifa_ifwithaddr((struct sockaddr *)&ipaddr); - if (ia == 0) { + if (ia == NULL) { if (opt == IPOPT_SSRR) { type = ICMP_UNREACH; code = ICMP_UNREACH_SRCFAIL; @@ -1430,11 +1430,11 @@ dropit: if (opt == IPOPT_SSRR) { #define INA struct in_ifaddr * #define SA struct sockaddr * - if ((ia = (INA)ifa_ifwithdstaddr((SA)&ipaddr)) == 0) + if ((ia = (INA)ifa_ifwithdstaddr((SA)&ipaddr)) == NULL) ia = (INA)ifa_ifwithnet((SA)&ipaddr); } else ia = ip_rtaddr(ipaddr.sin_addr); - if (ia == 0) { + if (ia == NULL) { type = ICMP_UNREACH; code = ICMP_UNREACH_SRCFAIL; goto bad; @@ -1474,8 +1474,8 @@ dropit: * locate outgoing interface; if we're the destination, * use the incoming interface (should be same). */ - if ((ia = (INA)ifa_ifwithaddr((SA)&ipaddr)) == 0 && - (ia = ip_rtaddr(ipaddr.sin_addr)) == 0) { + if ((ia = (INA)ifa_ifwithaddr((SA)&ipaddr)) == NULL && + (ia = ip_rtaddr(ipaddr.sin_addr)) == NULL) { type = ICMP_UNREACH; code = ICMP_UNREACH_HOST; goto bad; @@ -1523,7 +1523,7 @@ dropit: ipaddr.sin_addr = dst; ia = (INA)ifaof_ifpforaddr((SA)&ipaddr, m->m_pkthdr.rcvif); - if (ia == 0) + if (ia == NULL) continue; (void)memcpy(sin, &IA_SIN(ia)->sin_addr, sizeof(struct in_addr)); @@ -1539,7 +1539,7 @@ dropit: } (void)memcpy(&ipaddr.sin_addr, sin, sizeof(struct in_addr)); - if (ifa_ifwithaddr((SA)&ipaddr) == 0) + if (ifa_ifwithaddr((SA)&ipaddr) == NULL) continue; cp[IPOPT_OFFSET] += sizeof(struct in_addr); off += sizeof(struct in_addr); @@ -1629,7 +1629,7 @@ ip_srcroute() if (ip_nhops == 0) return ((struct mbuf *)0); m = m_get(M_DONTWAIT, MT_HEADER); - if (m == 0) + if (m == NULL) return ((struct mbuf *)0); #define OPTSIZ (sizeof(ip_srcrt.nop) + sizeof(ip_srcrt.srcopt)) @@ -1780,7 +1780,7 @@ ip_forward(struct mbuf *m, int srcrt, struct sockaddr_in *next_hop) } #endif - if ((ia = ip_rtaddr(pkt_dst)) == 0) { + if ((ia = ip_rtaddr(pkt_dst)) == NULL) { icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0); return; } diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 6705f7d45871..8f7003ca4a5a 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -240,7 +240,7 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, RTFREE(ro->ro_rt); ro->ro_rt = (struct rtentry *)0; } - if (ro->ro_rt == 0) { + if (ro->ro_rt == NULL) { bzero(dst, sizeof(*dst)); dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); @@ -251,8 +251,8 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, * short circuit routing lookup. */ if (flags & IP_ROUTETOIF) { - if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == 0 && - (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == 0) { + if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == NULL && + (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == NULL) { ipstat.ips_noroute++; error = ENETUNREACH; goto bad; @@ -275,9 +275,9 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, * as this is probably required in all cases for correct * operation (as it is for ARP). */ - if (ro->ro_rt == 0) + if (ro->ro_rt == NULL) rtalloc_ign(ro, 0); - if (ro->ro_rt == 0) { + if (ro->ro_rt == NULL) { ipstat.ips_noroute++; error = EHOSTUNREACH; goto bad; @@ -899,7 +899,7 @@ spd_done: ro_fwd->ro_rt = 0; rtalloc_ign(ro_fwd, RTF_CLONING); - if (ro_fwd->ro_rt == 0) { + if (ro_fwd->ro_rt == NULL) { ipstat.ips_noroute++; error = EHOSTUNREACH; goto bad; @@ -1163,7 +1163,7 @@ smart_frag_failure: int mhlen = sizeof (struct ip); MGETHDR(m, M_DONTWAIT, MT_HEADER); - if (m == 0) { + if (m == NULL) { error = ENOBUFS; ipstat.ips_odropped++; goto done; @@ -1192,7 +1192,7 @@ smart_frag_failure: mhip->ip_off |= IP_MF; mhip->ip_len = htons((u_short)(len + mhlen)); m->m_next = m_copy(m0, off, len); - if (m->m_next == 0) { /* copy failed */ + if (m->m_next == NULL) { /* copy failed */ m_free(m); error = ENOBUFS; /* ??? */ ipstat.ips_odropped++; @@ -1289,7 +1289,7 @@ ip_insertoptions(m, opt, phlen) ip->ip_dst = p->ipopt_dst; if (m->m_flags & M_EXT || m->m_data - optlen < m->m_pktdat) { MGETHDR(n, M_DONTWAIT, MT_HEADER); - if (n == 0) { + if (n == NULL) { *phlen = 0; return (m); } @@ -1394,7 +1394,7 @@ ip_ctloutput(so, sopt) break; } MGET(m, sopt->sopt_td ? M_TRYWAIT : M_DONTWAIT, MT_HEADER); - if (m == 0) { + if (m == NULL) { error = ENOBUFS; break; } |