Sparse fixes: NULL use, header order, ANSI prototypes, static
[qemu] / slirp / ip_input.c
index 505149a..c37412e 100644 (file)
@@ -60,7 +60,7 @@ static void ip_deq(register struct ipasfrag *p);
  * All protocols not implemented in kernel go to raw IP protocol handler.
  */
 void
-ip_init()
+ip_init(void)
 {
        ipq.ip_link.next = ipq.ip_link.prev = &ipq.ip_link;
        ip_id = tt.tv_sec & 0xffff;
@@ -73,8 +73,7 @@ ip_init()
  * try to reassemble.  Process options.  Pass to next level.
  */
 void
-ip_input(m)
-       struct mbuf *m;
+ip_input(struct mbuf *m)
 {
        register struct ip *ip;
        int hlen;
@@ -222,7 +221,7 @@ ip_input(m)
                if (ip->ip_tos & 1 || ip->ip_off) {
                        STAT(ipstat.ips_fragments++);
                        ip = ip_reass(ip, fp);
-                       if (ip == 0)
+                        if (ip == NULL)
                                return;
                        STAT(ipstat.ips_reassembled++);
                        m = dtom(ip);
@@ -289,7 +288,7 @@ ip_reass(register struct ip *ip, register struct ipq *fp)
        /*
         * If first fragment to arrive, create a reassembly queue.
         */
-       if (fp == 0) {
+        if (fp == NULL) {
          struct mbuf *t;
          if ((t = m_get()) == NULL) goto dropfrag;
          fp = mtod(t, struct ipq *);
@@ -357,11 +356,11 @@ insert:
        for (q = fp->frag_link.next; q != (struct ipasfrag*)&fp->frag_link;
             q = q->ipf_next) {
                if (q->ipf_off != next)
-                       return (0);
+                        return NULL;
                next += q->ipf_len;
        }
        if (((struct ipasfrag *)(q->ipf_prev))->ipf_tos & 1)
-               return (0);
+                return NULL;
 
        /*
         * Reassembly is complete; concatenate fragments.
@@ -414,7 +413,7 @@ insert:
 dropfrag:
        STAT(ipstat.ips_fragdropped++);
        m_freem(m);
-       return (0);
+        return NULL;
 }
 
 /*
@@ -466,7 +465,7 @@ ip_deq(register struct ipasfrag *p)
  * queue, discard it.
  */
 void
-ip_slowtimo()
+ip_slowtimo(void)
 {
     struct qlink *l;
 
@@ -474,7 +473,7 @@ ip_slowtimo()
 
     l = ipq.ip_link.next;
 
-       if (l == 0)
+        if (l == NULL)
           return;
 
        while (l != &ipq.ip_link) {
@@ -702,9 +701,7 @@ bad:
  * (XXX) should be deleted; last arg currently ignored.
  */
 void
-ip_stripoptions(m, mopt)
-       register struct mbuf *m;
-       struct mbuf *mopt;
+ip_stripoptions(register struct mbuf *m, struct mbuf *mopt)
 {
        register int i;
        struct ip *ip = mtod(m, struct ip *);