Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): remove redundant null check from s2Boo...



details:   https://anonhg.NetBSD.org/src/rev/05781e928b97
branches:  trunk
changeset: 956464:05781e928b97
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Oct 31 09:27:19 2020 +0000

description:
make(1): remove redundant null check from s2Boolean

diffstat:

 usr.bin/make/main.c |  34 ++++++++++++++++------------------
 usr.bin/make/var.c  |   6 +++---
 2 files changed, 19 insertions(+), 21 deletions(-)

diffs (82 lines):

diff -r 0bb58ff95ac7 -r 05781e928b97 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sat Oct 31 09:23:38 2020 +0000
+++ b/usr.bin/make/main.c       Sat Oct 31 09:27:19 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.415 2020/10/31 09:23:38 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.416 2020/10/31 09:27:19 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.415 2020/10/31 09:23:38 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.416 2020/10/31 09:27:19 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -2206,22 +2206,20 @@
 Boolean
 s2Boolean(const char *s, Boolean bf)
 {
-    if (s) {
-       switch(*s) {
-       case '\0':                      /* not set - the default wins */
-           break;
-       case '0':
-       case 'F':
-       case 'f':
-       case 'N':
-       case 'n':
-           return FALSE;
-       case 'O':
-       case 'o':
-           return s[1] != 'F' && s[1] != 'f';
-       default:
-           return TRUE;
-       }
+    switch(s[0]) {
+    case '\0':                 /* not set - the default wins */
+       break;
+    case '0':
+    case 'F':
+    case 'f':
+    case 'N':
+    case 'n':
+       return FALSE;
+    case 'O':
+    case 'o':
+       return s[1] != 'F' && s[1] != 'f';
+    default:
+       return TRUE;
     }
     return bf;
 }
diff -r 0bb58ff95ac7 -r 05781e928b97 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sat Oct 31 09:23:38 2020 +0000
+++ b/usr.bin/make/var.c        Sat Oct 31 09:27:19 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.612 2020/10/31 09:03:36 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.613 2020/10/31 09:27:19 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -129,7 +129,7 @@
 #include    "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.612 2020/10/31 09:03:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.613 2020/10/31 09:27:19 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -853,7 +853,7 @@
         * Makefile settings.
         */
        if (!opts.varNoExportEnv)
-           setenv(name, val ? val : "", 1);
+           setenv(name, val, 1);
 
        Var_Append(MAKEOVERRIDES, name, VAR_GLOBAL);
     }



Home | Main Index | Thread Index | Old Index