Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Remove redundant tests: if optlen === 0, then o...



details:   https://anonhg.NetBSD.org/src/rev/3421f7abcb59
branches:  trunk
changeset: 820235:3421f7abcb59
user:      kre <kre%NetBSD.org@localhost>
date:      Wed Jan 04 12:35:14 2017 +0000

description:
Remove redundant tests:  if optlen === 0, then optlen % 4 != 2 (it is 0)
so there is no need to test both.

diffstat:

 sys/netinet/tcp_input.c  |  6 +++---
 sys/netinet/tcp_output.c |  8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diffs (63 lines):

diff -r c30cfb68aa0a -r 3421f7abcb59 sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c   Wed Jan 04 10:06:43 2017 +0000
+++ b/sys/netinet/tcp_input.c   Wed Jan 04 12:35:14 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_input.c,v 1.352 2017/01/02 01:18:42 christos Exp $ */
+/*     $NetBSD: tcp_input.c,v 1.353 2017/01/04 12:35:14 kre Exp $      */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.352 2017/01/02 01:18:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.353 2017/01/04 12:35:14 kre Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -4656,7 +4656,7 @@
        }
 
        if (sc->sc_flags & SCF_TIMESTAMP) {
-                while (!optlen || optlen % 4 != 2) {
+                while (optlen % 4 != 2) {
                         optlen += TCPOLEN_NOP;
                         *optp++ = TCPOPT_NOP;
                 }
diff -r c30cfb68aa0a -r 3421f7abcb59 sys/netinet/tcp_output.c
--- a/sys/netinet/tcp_output.c  Wed Jan 04 10:06:43 2017 +0000
+++ b/sys/netinet/tcp_output.c  Wed Jan 04 12:35:14 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_output.c,v 1.192 2017/01/03 20:59:32 christos Exp $        */
+/*     $NetBSD: tcp_output.c,v 1.193 2017/01/04 12:35:14 kre Exp $     */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -135,7 +135,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.192 2017/01/03 20:59:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.193 2017/01/04 12:35:14 kre Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1194,7 +1194,7 @@
            ((flags & (TH_SYN|TH_ACK)) == TH_SYN ||
             (tp->t_flags & TF_RCVD_TSTMP))) {
                int alen = 0;
-               while (!optlen || optlen % 4 != 2) {
+               while (optlen % 4 != 2) {
                        optlen += TCPOLEN_NOP;
                        *optp++ = TCPOPT_NOP;
                        alen++;
@@ -1242,7 +1242,7 @@
        if (sack_numblks) {
                int alen = 0;
                int sack_len = sack_numblks * 8;
-               while (!optlen || optlen % 4 != 2) {
+               while (optlen % 4 != 2) {
                        optlen += TCPOLEN_NOP;
                        *optp++ = TCPOPT_NOP;
                        alen++;



Home | Main Index | Thread Index | Old Index