shithub: riscv

Download patch

ref: dbf13129a702cc066517acf147fb01c13df456cb
parent: 9860172fce3e8d030de6a8a5ed5de2d77483795a
author: cinap_lenrek <[email protected]>
date: Sun Apr 22 14:49:01 EDT 2018

devip: cleanup rudp.c

--- a/sys/src/9/ip/rudp.c
+++ b/sys/src/9/ip/rudp.c
@@ -280,7 +280,7 @@
 	/* force out any delayed acks */
 	ucb = (Rudpcb*)c->ptcl;
 	qlock(ucb);
-	for(r = ucb->r; r; r = r->next){
+	for(r = ucb->r; r != nil; r = r->next){
 		if(r->acksent != r->rcvseq)
 			relsendack(c, r, 0);
 	}
@@ -573,13 +573,11 @@
 	}
 
 	if(qfull(c->rq)) {
-		netlog(f, Logrudp, "rudp: qfull %I.%d -> %I.%d\n", raddr, rport,
-			laddr, lport);
+		netlog(f, Logrudp, "rudp: qfull %I.%d -> %I.%d\n",
+			raddr, rport, laddr, lport);
 		freeblist(bp);
 	} else {
-		if(bp->next)
-			bp = concatblock(bp);
-		qpass(c->rq, bp);
+		qpass(c->rq, concatblock(bp));
 	}
 	qunlock(ucb);
 }
@@ -638,8 +636,7 @@
 	pdest = nhgets(h->udpdport);
 
 	/* Look for a connection */
-	for(p = rudp->conv; *p; p++) {
-		s = *p;
+	for(p = rudp->conv; (s = *p) != nil; p++) {
 		if(s->rport == pdest)
 		if(s->lport == psource)
 		if(ipcmp(s->raddr, dest) == 0)