aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--if.c5
-rw-r--r--ip_icmp.c5
-rw-r--r--ip_input.c21
-rw-r--r--ip_output.c7
-rw-r--r--libslirp.h2
-rw-r--r--mbuf.c23
-rw-r--r--misc.c25
-rw-r--r--sbuf.c16
-rw-r--r--slirp.c8
-rw-r--r--socket.c39
-rw-r--r--tcp_input.c23
-rw-r--r--tcp_output.c4
-rw-r--r--tcp_subr.c40
13 files changed, 94 insertions, 124 deletions
diff --git a/if.c b/if.c
index 27503fd..84f28e6 100644
--- a/if.c
+++ b/if.c
@@ -29,7 +29,7 @@ static void ifs_remque(struct mbuf *ifm)
ifm->ifs_next->ifs_prev = ifm->ifs_prev;
}
-void if_init()
+void if_init(void)
{
if_fastq.ifq_next = if_fastq.ifq_prev = &if_fastq;
if_batchq.ifq_next = if_batchq.ifq_prev = &if_batchq;
@@ -129,8 +129,7 @@ if_input(ttyp)
* to the fastq (eg. if the user does an ls -alR in a telnet session,
* it'll temporarily get downgraded to the batchq)
*/
-void if_output(so, ifm) struct socket *so;
-struct mbuf *ifm;
+void if_output(struct socket *so, struct mbuf *ifm)
{
struct mbuf *ifq;
int on_fastq = 1;
diff --git a/ip_icmp.c b/ip_icmp.c
index 41248ef..075d1c7 100644
--- a/ip_icmp.c
+++ b/ip_icmp.c
@@ -69,8 +69,7 @@ static const int icmp_flush[19] = {
/*
* Process a received ICMP message.
*/
-void icmp_input(m, hlen) struct mbuf *m;
-int hlen;
+void icmp_input(struct mbuf *m, int hlen)
{
register struct icmp *icp;
register struct ip *ip = mtod(m, struct ip *);
@@ -330,7 +329,7 @@ end_error:
/*
* Reflect the ip packet back to the source
*/
-void icmp_reflect(m) struct mbuf *m;
+void icmp_reflect(struct mbuf *m)
{
register struct ip *ip = mtod(m, struct ip *);
int hlen = ip->ip_hl << 2;
diff --git a/ip_input.c b/ip_input.c
index fdc8db5..c214a54 100644
--- a/ip_input.c
+++ b/ip_input.c
@@ -57,7 +57,7 @@ static void ip_deq(register struct ipasfrag *p);
* IP initialization: fill in IP protocol switch table.
* All protocols not implemented in kernel go to raw IP protocol handler.
*/
-void ip_init()
+void ip_init(void)
{
ipq.ip_link.next = ipq.ip_link.prev = &ipq.ip_link;
ip_id = tt.tv_sec & 0xffff;
@@ -69,7 +69,7 @@ void ip_init()
* Ip input routine. Checksum and byte swap header. If fragmented
* try to reassemble. Process options. Pass to next level.
*/
-void ip_input(m) struct mbuf *m;
+void ip_input(struct mbuf *m)
{
register struct ip *ip;
int hlen;
@@ -217,7 +217,7 @@ void ip_input(m) struct mbuf *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);
@@ -282,7 +282,7 @@ static struct ip *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;
@@ -351,11 +351,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.
@@ -408,7 +408,7 @@ insert:
dropfrag:
STAT(ipstat.ips_fragdropped++);
m_freem(m);
- return (0);
+ return NULL;
}
/*
@@ -457,7 +457,7 @@ static void ip_deq(register struct ipasfrag *p)
* if a timer expires on a reassembly
* queue, discard it.
*/
-void ip_slowtimo()
+void ip_slowtimo(void)
{
struct qlink *l;
@@ -465,7 +465,7 @@ void ip_slowtimo()
l = ipq.ip_link.next;
- if (l == 0)
+ if (l == NULL)
return;
while (l != &ipq.ip_link) {
@@ -686,8 +686,7 @@ return (1);
* will be moved, and return value is their length.
* (XXX) should be deleted; last arg currently ignored.
*/
-void ip_stripoptions(m, mopt) register struct mbuf *m;
-struct mbuf *mopt;
+void ip_stripoptions(register struct mbuf *m, struct mbuf *mopt)
{
register int i;
struct ip *ip = mtod(m, struct ip *);
diff --git a/ip_output.c b/ip_output.c
index dd0bf9a..258df08 100644
--- a/ip_output.c
+++ b/ip_output.c
@@ -52,8 +52,7 @@ u_int16_t ip_id;
* The mbuf chain containing the packet will be freed.
* The mbuf opt, if present, will not be freed.
*/
-int ip_output(so, m0) struct socket *so;
-struct mbuf *m0;
+int ip_output(struct socket *so, struct mbuf *m0)
{
register struct ip *ip;
register struct mbuf *m = m0;
@@ -133,7 +132,7 @@ struct mbuf *m0;
for (off = hlen + len; off < (u_int16_t)ip->ip_len; off += len) {
register struct ip *mhip;
m = m_get();
- if (m == 0) {
+ if (m == NULL) {
error = -1;
STAT(ipstat.ips_odropped++);
goto sendorfree;
@@ -183,7 +182,7 @@ struct mbuf *m0;
sendorfree:
for (m = m0; m; m = m0) {
m0 = m->m_nextpkt;
- m->m_nextpkt = 0;
+ m->m_nextpkt = NULL;
if (error == 0)
if_output(so, m);
else
diff --git a/libslirp.h b/libslirp.h
index 3356bdd..3f2689d 100644
--- a/libslirp.h
+++ b/libslirp.h
@@ -5,7 +5,7 @@
extern "C" {
#endif
-void slirp_init(int restrict, char *special_ip);
+void slirp_init(int restricted, char *special_ip);
void slirp_select_fill(int *pnfds, fd_set *readfds, fd_set *writefds,
fd_set *xfds);
diff --git a/mbuf.c b/mbuf.c
index 32e5397..50ff112 100644
--- a/mbuf.c
+++ b/mbuf.c
@@ -28,7 +28,7 @@ int mbuf_max = 0;
*/
#define SLIRP_MSIZE (IF_MTU + IF_MAXLINKHDR + sizeof(struct m_hdr) + 6)
-void m_init()
+void m_init(void)
{
m_freelist.m_next = m_freelist.m_prev = &m_freelist;
m_usedlist.m_next = m_usedlist.m_prev = &m_usedlist;
@@ -42,7 +42,7 @@ void m_init()
* free old mbufs, we mark all mbufs above mbuf_thresh as M_DOFREE,
* which tells m_free to actually free() it
*/
-struct mbuf *m_get()
+struct mbuf *m_get(void)
{
register struct mbuf *m;
int flags = 0;
@@ -71,14 +71,14 @@ struct mbuf *m_get()
m->m_size = SLIRP_MSIZE - sizeof(struct m_hdr);
m->m_data = m->m_dat;
m->m_len = 0;
- m->m_nextpkt = 0;
- m->m_prevpkt = 0;
+ m->m_nextpkt = NULL;
+ m->m_prevpkt = NULL;
end_error:
DEBUG_ARG("m = %lx", (long)m);
return m;
}
-void m_free(m) struct mbuf *m;
+void m_free(struct mbuf *m)
{
DEBUG_CALL("m_free");
DEBUG_ARG("m = %lx", (long)m);
@@ -110,7 +110,7 @@ void m_free(m) struct mbuf *m;
* the other.. if result is too big for one mbuf, malloc()
* an M_EXT data segment
*/
-void m_cat(m, n) register struct mbuf *m, *n;
+void m_cat(struct mbuf *m, struct mbuf *n)
{
/*
* If there's no room, realloc
@@ -126,8 +126,7 @@ void m_cat(m, n) register struct mbuf *m, *n;
/* make m size bytes large */
-void m_inc(m, size) struct mbuf *m;
-int size;
+void m_inc(struct mbuf *m, int size)
{
int datasize;
@@ -160,8 +159,7 @@ int size;
}
-void m_adj(m, len) struct mbuf *m;
-int len;
+void m_adj(struct mbuf *m, int len)
{
if (m == NULL)
return;
@@ -180,8 +178,7 @@ int len;
/*
* Copy len bytes from m, starting off bytes into n
*/
-int m_copy(n, m, off, len) struct mbuf *n, *m;
-int off, len;
+int m_copy(struct mbuf *n, struct mbuf *m, int off, int len)
{
if (len > M_FREEROOM(n))
return -1;
@@ -197,7 +194,7 @@ int off, len;
* XXX This is a kludge, I should eliminate the need for it
* Fortunately, it's not used often
*/
-struct mbuf *dtom(dat) void *dat;
+struct mbuf *dtom(void *dat)
{
struct mbuf *m;
diff --git a/misc.c b/misc.c
index 8517de0..4f9e753 100644
--- a/misc.c
+++ b/misc.c
@@ -69,7 +69,7 @@ redir_x(inaddr, start_port, display, screen)
/*
* Get our IP address and put it in our_addr
*/
-void getouraddr()
+void getouraddr(void)
{
char buff[256];
struct hostent *he = NULL;
@@ -87,7 +87,7 @@ struct quehead {
struct quehead *qh_rlink;
};
-inline void insque(a, b) void *a, *b;
+inline void insque(void *a, void *b)
{
register struct quehead *element = (struct quehead *)a;
register struct quehead *head = (struct quehead *)b;
@@ -98,7 +98,7 @@ inline void insque(a, b) void *a, *b;
(struct quehead *)element;
}
-inline void remque(a) void *a;
+inline void remque(void *a)
{
register struct quehead *element = (struct quehead *)a;
((struct quehead *)(element->qh_link))->qh_rlink = element->qh_rlink;
@@ -110,11 +110,8 @@ inline void remque(a) void *a;
/* #endif */
-int add_exec(ex_ptr, do_pty, exec, addr, port) struct ex_list **ex_ptr;
-int do_pty;
-char *exec;
-int addr;
-int port;
+int add_exec(struct ex_list **ex_ptr, int do_pty, char *exec, int addr,
+ int port)
{
struct ex_list *tmp_ptr;
@@ -347,7 +344,7 @@ int fork_exec(struct socket *so, const char *ex, int do_pty)
argv[i++] = strdup(curarg);
} while (c);
- argv[i] = 0;
+ argv[i] = NULL;
execvp(argv[0], (char **)argv);
/* Ooops, failed, let's tell the user why */
@@ -389,9 +386,9 @@ int fork_exec(struct socket *so, const char *ex, int do_pty)
fd_nonblock(so->s);
/* Append the telnet options now */
- if (so->so_m != 0 && do_pty == 1) {
+ if (so->so_m != NULL && do_pty == 1) {
sbappend(so, so->so_m);
- so->so_m = 0;
+ so->so_m = NULL;
}
return 1;
@@ -745,7 +742,7 @@ sprintf_len(char *string, const char *format, ...)
#endif
-void u_sleep(usec) int usec;
+void u_sleep(int usec)
{
struct timeval t;
fd_set fdset;
@@ -762,7 +759,7 @@ void u_sleep(usec) int usec;
* Set fd blocking and non-blocking
*/
-void fd_nonblock(fd) int fd;
+void fd_nonblock(int fd)
{
#ifdef FIONBIO
int opt = 1;
@@ -777,7 +774,7 @@ void fd_nonblock(fd) int fd;
#endif
}
-void fd_block(fd) int fd;
+void fd_block(int fd)
{
#ifdef FIONBIO
int opt = 0;
diff --git a/sbuf.c b/sbuf.c
index ab6d270..7e4e772 100644
--- a/sbuf.c
+++ b/sbuf.c
@@ -17,13 +17,12 @@ static void sbappendsb(struct sbuf *sb, struct mbuf *m);
* }
*/
-void sbfree(sb) struct sbuf *sb;
+void sbfree(struct sbuf *sb)
{
free(sb->sb_data);
}
-void sbdrop(sb, num) struct sbuf *sb;
-int num;
+void sbdrop(struct sbuf *sb, int num)
{
/*
* We can only drop how much we have
@@ -37,8 +36,7 @@ int num;
sb->sb_rptr -= sb->sb_datalen;
}
-void sbreserve(sb, size) struct sbuf *sb;
-int size;
+void sbreserve(struct sbuf *sb, int size)
{
if (sb->sb_data) {
/* Already alloced, realloc if necessary */
@@ -67,8 +65,7 @@ int size;
* this prevents an unnecessary copy of the data
* (the socket is non-blocking, so we won't hang)
*/
-void sbappend(so, m) struct socket *so;
-struct mbuf *m;
+void sbappend(struct socket *so, struct mbuf *m)
{
int ret = 0;
@@ -166,10 +163,7 @@ static void sbappendsb(struct sbuf *sb, struct mbuf *m)
* Don't update the sbuf rptr, this will be
* done in sbdrop when the data is acked
*/
-void sbcopy(sb, off, len, to) struct sbuf *sb;
-int off;
-int len;
-char *to;
+void sbcopy(struct sbuf *sb, int off, int len, char *to)
{
char *from;
diff --git a/slirp.c b/slirp.c
index 193139b..7402389 100644
--- a/slirp.c
+++ b/slirp.c
@@ -50,7 +50,7 @@ static const uint8_t zero_ethaddr[6] = { 0, 0, 0, 0, 0, 0 };
const char *slirp_special_ip = CTL_SPECIAL;
int slirp_restrict;
-int do_slowtimo;
+static int do_slowtimo;
int link_up;
struct timeval tt;
FILE *lfd;
@@ -171,7 +171,7 @@ static void slirp_cleanup(void)
static void slirp_state_save(QEMUFile *f, void *opaque);
static int slirp_state_load(QEMUFile *f, void *opaque, int version_id);
-void slirp_init(int restrict, char *special_ip)
+void slirp_init(int restricted, char *special_ip)
{
// debug_init("/tmp/slirp.log", DEBUG_DEFAULT);
@@ -184,7 +184,7 @@ void slirp_init(int restrict, char *special_ip)
#endif
link_up = 1;
- slirp_restrict = restrict;
+ slirp_restrict = restricted;
if_init();
ip_init();
@@ -232,7 +232,7 @@ static void updtime(void)
#else
static void updtime(void)
{
- gettimeofday(&tt, 0);
+ gettimeofday(&tt, NULL);
curtime = (u_int)tt.tv_sec * (u_int)1000;
curtime += (u_int)tt.tv_usec / (u_int)1000;
diff --git a/socket.c b/socket.c
index f627eb0..773957d 100644
--- a/socket.c
+++ b/socket.c
@@ -24,11 +24,8 @@ so_init()
}
#endif
-struct socket *solookup(head, laddr, lport, faddr, fport) struct socket *head;
-struct in_addr laddr;
-u_int lport;
-struct in_addr faddr;
-u_int fport;
+struct socket *solookup(struct socket *head, struct in_addr laddr, u_int lport,
+ struct in_addr faddr, u_int fport)
{
struct socket *so;
@@ -48,7 +45,7 @@ u_int fport;
* It is the responsibility of the caller to
* insque() it into the correct linked-list
*/
-struct socket *socreate()
+struct socket *socreate(void)
{
struct socket *so;
@@ -64,7 +61,7 @@ struct socket *socreate()
/*
* remque and free a socket, clobber cache
*/
-void sofree(so) struct socket *so;
+void sofree(struct socket *so)
{
if (so->so_emu == EMU_RSH && so->extra) {
sofree(so->extra);
@@ -150,7 +147,7 @@ size_t sopreprbuf(struct socket *so, struct iovec *iov, int *np)
* NOTE: This will only be called if it is select()ed for reading, so
* a read() of 0 (or less) means it's disconnected
*/
-int soread(so) struct socket *so;
+int soread(struct socket *so)
{
int n, nn;
struct sbuf *sb = &so->so_snd;
@@ -261,7 +258,7 @@ err:
* so when OOB data arrives, we soread() it and everything
* in the send buffer is sent as urgent data
*/
-void sorecvoob(so) struct socket *so;
+void sorecvoob(struct socket *so)
{
struct tcpcb *tp = sototcpcb(so);
@@ -287,7 +284,7 @@ void sorecvoob(so) struct socket *so;
* Send urgent data
* There's a lot duplicated code here, but...
*/
-int sosendoob(so) struct socket *so;
+int sosendoob(struct socket *so)
{
struct sbuf *sb = &so->so_rcv;
char buff[2048]; /* XXX Shouldn't be sending more oob data than this */
@@ -351,7 +348,7 @@ int sosendoob(so) struct socket *so;
* Write data from so_rcv to so's socket,
* updating all sbuf field as necessary
*/
-int sowrite(so) struct socket *so;
+int sowrite(struct socket *so)
{
int n, nn;
struct sbuf *sb = &so->so_rcv;
@@ -448,7 +445,7 @@ int sowrite(so) struct socket *so;
/*
* recvfrom() a UDP socket
*/
-void sorecvfrom(so) struct socket *so;
+void sorecvfrom(struct socket *so)
{
struct sockaddr_in addr;
socklen_t addrlen = sizeof(struct sockaddr_in);
@@ -476,7 +473,7 @@ void sorecvfrom(so) struct socket *so;
icmp_error(so->so_m, ICMP_UNREACH, code, 0, strerror(errno));
} else {
icmp_reflect(so->so_m);
- so->so_m = 0; /* Don't m_free() it again! */
+ so->so_m = NULL; /* Don't m_free() it again! */
}
/* No need for this socket anymore, udp_detach it */
udp_detach(so);
@@ -550,8 +547,7 @@ void sorecvfrom(so) struct socket *so;
/*
* sendto() a socket
*/
-int sosendto(so, m) struct socket *so;
-struct mbuf *m;
+int sosendto(struct socket *so, struct mbuf *m)
{
int ret;
struct sockaddr_in addr;
@@ -599,10 +595,7 @@ struct mbuf *m;
/*
* XXX This should really be tcp_listen
*/
-struct socket *solisten(port, laddr, lport, flags) u_int port;
-u_int32_t laddr;
-u_int lport;
-int flags;
+struct socket *solisten(u_int port, u_int32_t laddr, u_int lport, int flags)
{
struct sockaddr_in addr;
struct socket *so;
@@ -705,14 +698,14 @@ sowwakeup(so)
* The socket state stuff needs work, these often get call 2 or 3
* times each when only 1 was needed
*/
-void soisfconnecting(so) register struct socket *so;
+void soisfconnecting(struct socket *so)
{
so->so_state &= ~(SS_NOFDREF | SS_ISFCONNECTED | SS_FCANTRCVMORE |
SS_FCANTSENDMORE | SS_FWDRAIN);
so->so_state |= SS_ISFCONNECTING; /* Clobber other states */
}
-void soisfconnected(so) register struct socket *so;
+void soisfconnected(struct socket *so)
{
so->so_state &= ~(SS_ISFCONNECTING | SS_FWDRAIN | SS_NOFDREF);
so->so_state |= SS_ISFCONNECTED; /* Clobber other states */
@@ -752,7 +745,7 @@ static void sofcantsendmore(struct socket *so)
so->so_state |= SS_FCANTSENDMORE;
}
-void soisfdisconnected(so) struct socket *so;
+void soisfdisconnected(struct socket *so)
{
/* so->so_state &= ~(SS_ISFCONNECTING|SS_ISFCONNECTED); */
/* close(so->s); */
@@ -766,7 +759,7 @@ void soisfdisconnected(so) struct socket *so;
* Set write drain mode
* Set CANTSENDMORE once all data has been write()n
*/
-void sofwdrain(so) struct socket *so;
+void sofwdrain(struct socket *so)
{
if (so->so_rcv.sb_cc)
so->so_state |= SS_FWDRAIN;
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;
diff --git a/tcp_output.c b/tcp_output.c
index 90c2a05..91ef0f3 100644
--- a/tcp_output.c
+++ b/tcp_output.c
@@ -63,7 +63,7 @@ static const u_char tcp_outflags[TCP_NSTATES] = {
/*
* Tcp output routine: figure out what should be sent and send it.
*/
-int tcp_output(tp) register struct tcpcb *tp;
+int tcp_output(struct tcpcb *tp)
{
register struct socket *so = tp->t_socket;
register long len, win;
@@ -573,7 +573,7 @@ send:
return (0);
}
- void tcp_setpersist(tp) register struct tcpcb *tp;
+ void tcp_setpersist(struct tcpcb * tp)
{
int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1;
diff --git a/tcp_subr.c b/tcp_subr.c
index b12d33e..22196d5 100644
--- a/tcp_subr.c
+++ b/tcp_subr.c
@@ -48,7 +48,7 @@
/*
* Tcp initialization
*/
-void tcp_init()
+void tcp_init(void)
{
tcp_iss = 1; /* wrong */
tcb.so_next = tcb.so_prev = &tcb;
@@ -61,7 +61,7 @@ void tcp_init()
* necessary when the connection is used.
*/
/* struct tcpiphdr * */
-void tcp_template(tp) struct tcpcb *tp;
+void tcp_template(struct tcpcb *tp)
{
struct socket *so = tp->t_socket;
register struct tcpiphdr *n = &tp->t_template;
@@ -98,11 +98,8 @@ void tcp_template(tp) struct tcpcb *tp;
* In any case the ack and sequence number of the transmitted
* segment are as specified by the parameters.
*/
-void tcp_respond(tp, ti, m, ack, seq, flags) struct tcpcb *tp;
-register struct tcpiphdr *ti;
-register struct mbuf *m;
-tcp_seq ack, seq;
-int flags;
+void tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m,
+ tcp_seq ack, tcp_seq seq, int flags)
{
register int tlen;
int win = 0;
@@ -117,7 +114,7 @@ int flags;
if (tp)
win = sbspace(&tp->t_socket->so_rcv);
- if (m == 0) {
+ if (m == NULL) {
if ((m = m_get()) == NULL)
return;
#ifdef TCP_COMPAT_42
@@ -153,7 +150,7 @@ int flags;
tlen += sizeof(struct tcpiphdr);
m->m_len = tlen;
- ti->ti_mbuf = 0;
+ ti->ti_mbuf = NULL;
ti->ti_x1 = 0;
ti->ti_seq = htonl(seq);
ti->ti_ack = htonl(ack);
@@ -182,7 +179,7 @@ int flags;
* empty reassembly queue and hooking it to the argument
* protocol control block.
*/
-struct tcpcb *tcp_newtcpcb(so) struct socket *so;
+struct tcpcb *tcp_newtcpcb(struct socket *so)
{
register struct tcpcb *tp;
@@ -255,7 +252,7 @@ struct tcpcb *tcp_drop(struct tcpcb *tp, int err)
* discard internet protocol block
* wake up any sleepers
*/
-struct tcpcb *tcp_close(tp) register struct tcpcb *tp;
+struct tcpcb *tcp_close(struct tcpcb *tp)
{
register struct tcpiphdr *t;
struct socket *so = tp->t_socket;
@@ -278,7 +275,7 @@ struct tcpcb *tcp_close(tp) register struct tcpcb *tp;
*/
/* free(tp, M_PCB); */
free(tp);
- so->so_tcpcb = 0;
+ so->so_tcpcb = NULL;
soisfdisconnected(so);
/* clobber input socket cache if we're closing the cached connection */
if (so == tcp_last_so)
@@ -327,7 +324,7 @@ void tcp_quench(i, errno)
* for peer to send FIN or not respond to keep-alives, etc.
* We can let the user exit from the close as soon as the FIN is acked.
*/
-void tcp_sockclosed(tp) struct tcpcb *tp;
+void tcp_sockclosed(struct tcpcb *tp)
{
DEBUG_CALL("tcp_sockclosed");
DEBUG_ARG("tp = %lx", (long)tp);
@@ -366,7 +363,7 @@ void tcp_sockclosed(tp) struct tcpcb *tp;
* nonblocking. Connect returns after the SYN is sent, and does
* not wait for ACK+SYN.
*/
-int tcp_fconnect(so) struct socket *so;
+int tcp_fconnect(struct socket *so)
{
int ret = 0;
@@ -428,7 +425,7 @@ int tcp_fconnect(so) struct socket *so;
* the time it gets to accept(), so... We simply accept
* here and SYN the local-host.
*/
-void tcp_connect(inso) struct socket *inso;
+void tcp_connect(struct socket *inso)
{
struct socket *so;
struct sockaddr_in addr;
@@ -515,7 +512,7 @@ void tcp_connect(inso) struct socket *inso;
/*
* Attach a TCPCB to a socket.
*/
-int tcp_attach(so) struct socket *so;
+int tcp_attach(struct socket *so)
{
if ((so->so_tcpcb = tcp_newtcpcb(so)) == NULL)
return -1;
@@ -547,12 +544,12 @@ static const struct tos_t tcptos[] = {
#ifdef CONFIG_QEMU
static
#endif
- struct emu_t *tcpemu = 0;
+ struct emu_t *tcpemu = NULL;
/*
* Return TOS according to the above table
*/
-u_int8_t tcp_tos(so) struct socket *so;
+u_int8_t tcp_tos(struct socket *so)
{
int i = 0;
struct emu_t *emup;
@@ -606,8 +603,7 @@ int do_echo = -1;
*
* NOTE: if you return 0 you MUST m_free() the mbuf!
*/
-int tcp_emu(so, m) struct socket *so;
-struct mbuf *m;
+int tcp_emu(struct socket *so, struct mbuf *m)
{
u_int n1, n2, n3, n4, n5, n6;
char buff[257];
@@ -961,7 +957,7 @@ do_prompt:
}
#endif
case EMU_FTP: /* ftp */
- *(m->m_data + m->m_len) = 0; /* NULL terminate for strstr */
+ *(m->m_data + m->m_len) = 0; /* NUL terminate for strstr */
if ((bptr = (char *)strstr(m->m_data, "ORT")) != NULL) {
/*
* Need to emulate the PORT command
@@ -1235,7 +1231,7 @@ do_prompt:
* Return 0 if this connections is to be closed, 1 otherwise,
* return 2 if this is a command-line connection
*/
-int tcp_ctl(so) struct socket *so;
+int tcp_ctl(struct socket *so)
{
struct sbuf *sb = &so->so_snd;
int command;