From 511d2b140f3ff2f80d14637cdc2f29743a2daa51 Mon Sep 17 00:00:00 2001 From: blueswir1 Date: Sat, 7 Mar 2009 15:32:56 +0000 Subject: Sparse fixes: NULL use, header order, ANSI prototypes, static Fix Sparse warnings: * use NULL instead of plain 0 * rearrange header include order to avoid redefining types accidentally * ANSIfy SLIRP * avoid "restrict" keyword * add static git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6736 c046a42c-6fe2-441c-8c8c-71466251a162 --- slirp/ip_input.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'slirp/ip_input.c') diff --git a/slirp/ip_input.c b/slirp/ip_input.c index 505149a33e..c37412e8cf 100644 --- a/slirp/ip_input.c +++ b/slirp/ip_input.c @@ -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 *); -- cgit v1.2.3