aboutsummaryrefslogtreecommitdiff
path: root/tcp_input.c
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-07 15:32:56 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-07 15:32:56 +0000
commit5b0221f02c31cdba31f9f41cdf4e3a4f601b085e (patch)
tree429a6322b9bf65f6d8652d2f9bf16a50d59b6ac3 /tcp_input.c
parent6b3fa17afdbbf844287750380fae74ebfeff73e8 (diff)
downloadslirp-5b0221f02c31cdba31f9f41cdf4e3a4f601b085e.zip
slirp-5b0221f02c31cdba31f9f41cdf4e3a4f601b085e.tar.gz
slirp-5b0221f02c31cdba31f9f41cdf4e3a4f601b085e.tar.bz2
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 'tcp_input.c')
-rw-r--r--tcp_input.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/tcp_input.c b/tcp_input.c
index bce91f5..383457f 100644
--- a/tcp_input.c
+++ b/tcp_input.c
@@ -122,10 +122,10 @@ static int tcp_reass(register struct tcpcb *tp, register struct tcpiphdr *ti,
int flags;
/*
- * Call with ti==0 after become established to
+ * Call with ti==NULL after become established to
* force pre-ESTABLISHED data up to user socket.
*/
- if (ti == 0)
+ if (ti == NULL)
goto present;
/*
@@ -231,18 +231,16 @@ present:
* TCP input routine, follows pages 65-76 of the
* protocol specification dated September, 1981 very closely.
*/
-void tcp_input(m, iphlen, inso) register struct mbuf *m;
-int iphlen;
-struct socket *inso;
+void tcp_input(struct mbuf *m, int iphlen, struct socket *inso)
{
struct ip save_ip, *ip;
register struct tcpiphdr *ti;
caddr_t optp = NULL;
int optlen = 0;
int len, tlen, off;
- register struct tcpcb *tp = 0;
+ register struct tcpcb *tp = NULL;
register int tiflags;
- struct socket *so = 0;
+ struct socket *so = NULL;
int todrop, acked, ourfinisacked, needoutput = 0;
/* int dropsocket = 0; */
int iss = 0;
@@ -264,7 +262,7 @@ struct socket *inso;
/* Re-set a few variables */
tp = sototcpcb(so);
m = so->so_m;
- so->so_m = 0;
+ so->so_m = NULL;
ti = so->so_ti;
tiwin = ti->ti_win;
tiflags = ti->ti_flags;
@@ -298,7 +296,7 @@ struct socket *inso;
* Checksum extended TCP header and data.
*/
tlen = ((struct ip *)ti)->ip_len;
- tcpiphdr2qlink(ti)->next = tcpiphdr2qlink(ti)->prev = 0;
+ tcpiphdr2qlink(ti)->next = tcpiphdr2qlink(ti)->prev = NULL;
memset(&ti->ti_i.ih_mbuf, 0, sizeof(struct mbuf_ptr));
ti->ti_x1 = 0;
ti->ti_len = htons((u_int16_t)tlen);
@@ -397,7 +395,7 @@ findso:
* the only flag set, then create a session, mark it
* as if it was LISTENING, and continue...
*/
- if (so == 0) {
+ if (so == NULL) {
if ((tiflags & (TH_SYN | TH_FIN | TH_RST | TH_URG | TH_ACK)) != TH_SYN)
goto dropwithreset;
@@ -437,7 +435,7 @@ findso:
tp = sototcpcb(so);
/* XXX Should never fail */
- if (tp == 0)
+ if (tp == NULL)
goto dropwithreset;
if (tp->t_state == TCPS_CLOSED)
goto drop;
@@ -1684,8 +1682,7 @@ static void tcp_xmit_timer(register struct tcpcb *tp, int rtt)
* parameters from pre-set or cached values in the routing entry.
*/
-int tcp_mss(tp, offer) register struct tcpcb *tp;
-u_int offer;
+int tcp_mss(struct tcpcb *tp, u_int offer)
{
struct socket *so = tp->t_socket;
int mss;