Module Name: src
Committed By: rillig
Date: Sat Oct 31 09:27:20 UTC 2020
Modified Files:
src/usr.bin/make: main.c var.c
Log Message:
make(1): remove redundant null check from s2Boolean
To generate a diff of this commit:
cvs rdiff -u -r1.415 -r1.416 src/usr.bin/make/main.c
cvs rdiff -u -r1.612 -r1.613 src/usr.bin/make/var.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.415 src/usr.bin/make/main.c:1.416
--- src/usr.bin/make/main.c:1.415 Sat Oct 31 09:23:38 2020
+++ src/usr.bin/make/main.c Sat Oct 31 09:27:19 2020
@@ -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 @@ mkTempFile(const char *pattern, char **o
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;
}
Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.612 src/usr.bin/make/var.c:1.613
--- src/usr.bin/make/var.c:1.612 Sat Oct 31 09:03:36 2020
+++ src/usr.bin/make/var.c Sat Oct 31 09:27:19 2020
@@ -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 @@ Var_Set_with_flags(const char *name, con
* Makefile settings.
*/
if (!opts.varNoExportEnv)
- setenv(name, val ? val : "", 1);
+ setenv(name, val, 1);
Var_Append(MAKEOVERRIDES, name, VAR_GLOBAL);
}