diff options
author | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-03-07 15:32:56 +0000 |
---|---|---|
committer | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-03-07 15:32:56 +0000 |
commit | 511d2b140f3ff2f80d14637cdc2f29743a2daa51 (patch) | |
tree | 6cf21d1c95846f1c86879c60dffbe6a3eaa8aa6d /slirp/ip_input.c | |
parent | c2764719914ff0c4d6c06adafea17629600f21ba (diff) | |
download | hqemu-511d2b140f3ff2f80d14637cdc2f29743a2daa51.zip hqemu-511d2b140f3ff2f80d14637cdc2f29743a2daa51.tar.gz |
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
Diffstat (limited to 'slirp/ip_input.c')
-rw-r--r-- | slirp/ip_input.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/slirp/ip_input.c b/slirp/ip_input.c index 505149a..c37412e 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 *); |