Author: pfg
Date: Fri Apr 15 15:46:41 2016
New Revision: 298066
URL: https://svnweb.freebsd.org/changeset/base/298066

Log:
  netinet: for pointers replace 0 with NULL.
  
  These are mostly cosmetical, no functional change.
  
  Found with devel/coccinelle.
  
  Reviewed by:  ae. tuexen

Modified:
  head/sys/netinet/if_ether.c
  head/sys/netinet/igmp.c
  head/sys/netinet/in_mcast.c
  head/sys/netinet/ip_divert.c
  head/sys/netinet/ip_icmp.c
  head/sys/netinet/ip_mroute.c
  head/sys/netinet/ip_options.c
  head/sys/netinet/ip_output.c
  head/sys/netinet/libalias/alias_db.c
  head/sys/netinet/raw_ip.c
  head/sys/netinet/sctp_syscalls.c
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet/udp_usrreq.c

Modified: head/sys/netinet/if_ether.c
==============================================================================
--- head/sys/netinet/if_ether.c Fri Apr 15 15:44:02 2016        (r298065)
+++ head/sys/netinet/if_ether.c Fri Apr 15 15:46:41 2016        (r298066)
@@ -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;

Modified: head/sys/netinet/igmp.c
==============================================================================
--- head/sys/netinet/igmp.c     Fri Apr 15 15:44:02 2016        (r298065)
+++ head/sys/netinet/igmp.c     Fri Apr 15 15:46:41 2016        (r298066)
@@ -1469,7 +1469,7 @@ igmp_input(struct mbuf **mp, int *offp, 
        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);
        }

Modified: head/sys/netinet/in_mcast.c
==============================================================================
--- head/sys/netinet/in_mcast.c Fri Apr 15 15:44:02 2016        (r298065)
+++ head/sys/netinet/in_mcast.c Fri Apr 15 15:46:41 2016        (r298066)
@@ -1810,7 +1810,7 @@ inp_getmoptions(struct inpcb *inp, struc
                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, struc
                break;
 
        case IP_MULTICAST_LOOP:
-               if (imo == 0)
+               if (imo == NULL)
                        optval = coptval = IP_DEFAULT_MULTICAST_LOOP;
                else
                        optval = coptval = imo->imo_multicast_loop;

Modified: head/sys/netinet/ip_divert.c
==============================================================================
--- head/sys/netinet/ip_divert.c        Fri Apr 15 15:44:02 2016        
(r298065)
+++ head/sys/netinet/ip_divert.c        Fri Apr 15 15:46:41 2016        
(r298066)
@@ -205,7 +205,7 @@ divert_packet(struct mbuf *m, int incomi
        }
        /* 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, s
 
        /* 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);

Modified: head/sys/netinet/ip_icmp.c
==============================================================================
--- head/sys/netinet/ip_icmp.c  Fri Apr 15 15:44:02 2016        (r298065)
+++ head/sys/netinet/ip_icmp.c  Fri Apr 15 15:46:41 2016        (r298066)
@@ -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 @@ match:
                 * 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;

Modified: head/sys/netinet/ip_mroute.c
==============================================================================
--- head/sys/netinet/ip_mroute.c        Fri Apr 15 15:44:02 2016        
(r298065)
+++ head/sys/netinet/ip_mroute.c        Fri Apr 15 15:46:41 2016        
(r298066)
@@ -2601,7 +2601,7 @@ pim_input(struct mbuf **mp, int *offp, i
      * 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);
     }

Modified: head/sys/netinet/ip_options.c
==============================================================================
--- head/sys/netinet/ip_options.c       Fri Apr 15 15:44:02 2016        
(r298065)
+++ head/sys/netinet/ip_options.c       Fri Apr 15 15:46:41 2016        
(r298066)
@@ -608,7 +608,7 @@ ip_pcbopts(struct inpcb *inp, int optnam
        /* 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.

Modified: head/sys/netinet/ip_output.c
==============================================================================
--- head/sys/netinet/ip_output.c        Fri Apr 15 15:44:02 2016        
(r298065)
+++ head/sys/netinet/ip_output.c        Fri Apr 15 15:46:41 2016        
(r298066)
@@ -1348,7 +1348,7 @@ ip_ctloutput(struct socket *so, struct s
                        caddr_t req = NULL;
                        size_t len = 0;
 
-                       if (m != 0) {
+                       if (m != NULL) {
                                req = mtod(m, caddr_t);
                                len = m->m_len;
                        }

Modified: head/sys/netinet/libalias/alias_db.c
==============================================================================
--- head/sys/netinet/libalias/alias_db.c        Fri Apr 15 15:44:02 2016        
(r298065)
+++ head/sys/netinet/libalias/alias_db.c        Fri Apr 15 15:46:41 2016        
(r298066)
@@ -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 */

Modified: head/sys/netinet/raw_ip.c
==============================================================================
--- head/sys/netinet/raw_ip.c   Fri Apr 15 15:44:02 2016        (r298065)
+++ head/sys/netinet/raw_ip.c   Fri Apr 15 15:46:41 2016        (r298066)
@@ -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);

Modified: head/sys/netinet/sctp_syscalls.c
==============================================================================
--- head/sys/netinet/sctp_syscalls.c    Fri Apr 15 15:44:02 2016        
(r298065)
+++ head/sys/netinet/sctp_syscalls.c    Fri Apr 15 15:46:41 2016        
(r298066)
@@ -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);

Modified: head/sys/netinet/sctp_usrreq.c
==============================================================================
--- head/sys/netinet/sctp_usrreq.c      Fri Apr 15 15:44:02 2016        
(r298065)
+++ head/sys/netinet/sctp_usrreq.c      Fri Apr 15 15:46:41 2016        
(r298066)
@@ -469,7 +469,7 @@ sctp_attach(struct socket *so, int proto
        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);
        }

Modified: head/sys/netinet/udp_usrreq.c
==============================================================================
--- head/sys/netinet/udp_usrreq.c       Fri Apr 15 15:44:02 2016        
(r298065)
+++ head/sys/netinet/udp_usrreq.c       Fri Apr 15 15:46:41 2016        
(r298066)
@@ -308,7 +308,7 @@ udp_append(struct inpcb *inp, struct ip 
 {
        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);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to