Source-Changes-HG archive

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

[src/trunk]: src/sys/netipsec Simplify; we can assume the arguments are alway...



details:   https://anonhg.NetBSD.org/src/rev/f64279440fce
branches:  trunk
changeset: 824321:f64279440fce
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Thu Jun 01 09:50:35 2017 +0000

description:
Simplify; we can assume the arguments are always non-NULL

diffstat:

 sys/netipsec/key.c |  23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)

diffs (53 lines):

diff -r d90a8ab3375b -r f64279440fce sys/netipsec/key.c
--- a/sys/netipsec/key.c        Thu Jun 01 09:44:30 2017 +0000
+++ b/sys/netipsec/key.c        Thu Jun 01 09:50:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: key.c,v 1.160 2017/06/01 03:51:08 ozaki-r Exp $        */
+/*     $NetBSD: key.c,v 1.161 2017/06/01 09:50:35 ozaki-r Exp $        */
 /*     $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $        */
 /*     $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $   */
 
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.160 2017/06/01 03:51:08 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.161 2017/06/01 09:50:35 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -4155,13 +4155,10 @@
        int chkport;
        const struct sockaddr *sa0src, *sa0dst, *sa1src, *sa1dst;
 
+       KASSERT(saidx0 != NULL);
+       KASSERT(saidx1 != NULL);
+
        /* sanity */
-       if (saidx0 == NULL && saidx1 == NULL)
-               return 1;
-
-       if (saidx0 == NULL || saidx1 == NULL)
-               return 0;
-
        if (saidx0->proto != saidx1->proto)
                return 0;
 
@@ -4234,13 +4231,11 @@
        const struct secpolicyindex *spidx0,
        const struct secpolicyindex *spidx1)
 {
+
+       KASSERT(spidx0 != NULL);
+       KASSERT(spidx1 != NULL);
+
        /* sanity */
-       if (spidx0 == NULL && spidx1 == NULL)
-               return 1;
-
-       if (spidx0 == NULL || spidx1 == NULL)
-               return 0;
-
        if (spidx0->prefs != spidx1->prefs ||
            spidx0->prefd != spidx1->prefd ||
            spidx0->ul_proto != spidx1->ul_proto)



Home | Main Index | Thread Index | Old Index