shithub: riscv

Download patch

ref: 9860172fce3e8d030de6a8a5ed5de2d77483795a
parent: c5c613357e45af55b9cca2ae90cfc89895a2bd48
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Apr 22 14:48:32 EDT 2018

devip: cleanup tcp.c

--- a/sys/src/9/ip/tcp.c
+++ b/sys/src/9/ip/tcp.c
@@ -3229,8 +3229,7 @@
 		v4tov6(source, h4->tcpsrc);
 		psource = nhgets(h4->tcpsport);
 		pdest = nhgets(h4->tcpdport);
-	}
-	else {
+	} else {
 		ipmove(dest, h6->tcpdst);
 		ipmove(source, h6->tcpsrc);
 		psource = nhgets(h6->tcpsport);
@@ -3239,8 +3238,7 @@
 
 	/* Look for a connection */
 	qlock(tcp);
-	for(p = tcp->conv; *p; p++) {
-		s = *p;
+	for(p = tcp->conv; (s = *p) != nil; p++) {
 		tcb = (Tcpctl*)s->ptcl;
 		if(s->rport == pdest)
 		if(s->lport == psource)