netinet: for pointers replace 0 with NULL.

These are mostly cosmetical, no functional change.

Found with devel/coccinelle.

Reviewed by:	ae. tuexen
This commit is contained in:
Pedro F. Giffuni 2016-04-15 15:46:41 +00:00
parent 915c6043b0
commit 99d628d577
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=298066
13 changed files with 20 additions and 20 deletions

View File

@ -578,7 +578,7 @@ int
arpresolve(struct ifnet *ifp, int is_gw, struct mbuf *m,
const struct sockaddr *dst, u_char *desten, uint32_t *pflags)
{
struct llentry *la = 0;
struct llentry *la = NULL;
if (pflags != NULL)
*pflags = 0;

View File

@ -1469,7 +1469,7 @@ igmp_input(struct mbuf **mp, int *offp, int proto)
else
minlen += IGMP_MINLEN;
if ((!M_WRITABLE(m) || m->m_len < minlen) &&
(m = m_pullup(m, minlen)) == 0) {
(m = m_pullup(m, minlen)) == NULL) {
IGMPSTAT_INC(igps_rcv_tooshort);
return (IPPROTO_DONE);
}

View File

@ -1810,7 +1810,7 @@ inp_getmoptions(struct inpcb *inp, struct sockopt *sopt)
break;
case IP_MULTICAST_TTL:
if (imo == 0)
if (imo == NULL)
optval = coptval = IP_DEFAULT_MULTICAST_TTL;
else
optval = coptval = imo->imo_multicast_ttl;
@ -1822,7 +1822,7 @@ inp_getmoptions(struct inpcb *inp, struct sockopt *sopt)
break;
case IP_MULTICAST_LOOP:
if (imo == 0)
if (imo == NULL)
optval = coptval = IP_DEFAULT_MULTICAST_LOOP;
else
optval = coptval = imo->imo_multicast_loop;

View File

@ -205,7 +205,7 @@ divert_packet(struct mbuf *m, int incoming)
}
/* Assure header */
if (m->m_len < sizeof(struct ip) &&
(m = m_pullup(m, sizeof(struct ip))) == 0)
(m = m_pullup(m, sizeof(struct ip))) == NULL)
return;
ip = mtod(m, struct ip *);
@ -600,7 +600,7 @@ div_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
/* Packet must have a header (but that's about it) */
if (m->m_len < sizeof (struct ip) &&
(m = m_pullup(m, sizeof (struct ip))) == 0) {
(m = m_pullup(m, sizeof (struct ip))) == NULL) {
KMOD_IPSTAT_INC(ips_toosmall);
m_freem(m);
return EINVAL;
@ -666,7 +666,7 @@ div_pcblist(SYSCTL_HANDLER_ARGS)
return error;
inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK);
if (inp_list == 0)
if (inp_list == NULL)
return ENOMEM;
INP_INFO_RLOCK(&V_divcbinfo);

View File

@ -674,7 +674,7 @@ icmp_reflect(struct mbuf *m)
struct in_ifaddr *ia;
struct in_addr t;
struct nhop4_extended nh_ext;
struct mbuf *opts = 0;
struct mbuf *opts = NULL;
int optlen = (ip->ip_hl << 2) - sizeof(struct ip);
if (IN_MULTICAST(ntohl(ip->ip_src.s_addr)) ||
@ -790,7 +790,7 @@ icmp_reflect(struct mbuf *m)
* add on any record-route or timestamp options.
*/
cp = (u_char *) (ip + 1);
if ((opts = ip_srcroute(m)) == 0 &&
if ((opts = ip_srcroute(m)) == NULL &&
(opts = m_gethdr(M_NOWAIT, MT_DATA))) {
opts->m_len = sizeof(struct in_addr);
mtod(opts, struct in_addr *)->s_addr = 0;

View File

@ -2601,7 +2601,7 @@ pim_input(struct mbuf **mp, int *offp, int proto)
* Get the IP and PIM headers in contiguous memory, and
* possibly the PIM REGISTER header.
*/
if (m->m_len < minlen && (m = m_pullup(m, minlen)) == 0) {
if (m->m_len < minlen && (m = m_pullup(m, minlen)) == NULL) {
CTR1(KTR_IPMF, "%s: m_pullup() failed", __func__);
return (IPPROTO_DONE);
}

View File

@ -608,7 +608,7 @@ ip_pcbopts(struct inpcb *inp, int optname, struct mbuf *m)
/* turn off any old options */
if (*pcbopt)
(void)m_free(*pcbopt);
*pcbopt = 0;
*pcbopt = NULL;
if (m == NULL || m->m_len == 0) {
/*
* Only turning off any previous options.

View File

@ -1348,7 +1348,7 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt)
caddr_t req = NULL;
size_t len = 0;
if (m != 0) {
if (m != NULL) {
req = mtod(m, caddr_t);
len = m->m_len;
}

View File

@ -784,9 +784,9 @@ FindNewPortGroup(struct libalias *la,
struct alias_link *search_result;
for (j = 0; j < port_count; j++)
if (0 != (search_result = FindLinkIn(la, dst_addr, alias_addr,
dst_port, htons(port_sys + j),
link_type, 0)))
if ((search_result = FindLinkIn(la, dst_addr,
alias_addr, dst_port, htons(port_sys + j),
link_type, 0)) != NULL)
break;
/* Found a good range, return base */

View File

@ -1046,7 +1046,7 @@ rip_pcblist(SYSCTL_HANDLER_ARGS)
return (error);
inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK);
if (inp_list == 0)
if (inp_list == NULL)
return (ENOMEM);
INP_INFO_RLOCK(&V_ripcbinfo);

View File

@ -562,7 +562,7 @@ sys_sctp_generic_recvmsg(td, uap)
if (fromlen && uap->from) {
len = fromlen;
if (len <= 0 || fromsa == 0)
if (len <= 0 || fromsa == NULL)
len = 0;
else {
len = MIN(len, fromsa->sa_len);

View File

@ -469,7 +469,7 @@ sctp_attach(struct socket *so, int proto SCTP_UNUSED, struct thread *p SCTP_UNUS
uint32_t vrf_id = SCTP_DEFAULT_VRFID;
inp = (struct sctp_inpcb *)so->so_pcb;
if (inp != 0) {
if (inp != NULL) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
return (EINVAL);
}

View File

@ -308,7 +308,7 @@ udp_append(struct inpcb *inp, struct ip *ip, struct mbuf *n, int off,
{
struct sockaddr *append_sa;
struct socket *so;
struct mbuf *opts = 0;
struct mbuf *opts = NULL;
#ifdef INET6
struct sockaddr_in6 udp_in6;
#endif
@ -856,7 +856,7 @@ udp_pcblist(SYSCTL_HANDLER_ARGS)
return (error);
inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK);
if (inp_list == 0)
if (inp_list == NULL)
return (ENOMEM);
INP_INFO_RLOCK(&V_udbinfo);