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 evaluations in VarFind
details: https://anonhg.NetBSD.org/src/rev/5138400c3d12
branches: trunk
changeset: 977634:5138400c3d12
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Oct 30 07:47:11 2020 +0000
description:
make(1): remove redundant evaluations in VarFind
diffstat:
usr.bin/make/var.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diffs (53 lines):
diff -r 81a656958215 -r 5138400c3d12 usr.bin/make/var.c
--- a/usr.bin/make/var.c Fri Oct 30 07:37:30 2020 +0000
+++ b/usr.bin/make/var.c Fri Oct 30 07:47:11 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.596 2020/10/30 07:37:30 rillig Exp $ */
+/* $NetBSD: var.c,v 1.597 2020/10/30 07:47:11 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.596 2020/10/30 07:37:30 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.597 2020/10/30 07:47:11 rillig Exp $");
#define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
#define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -377,11 +377,13 @@
* depending on the FIND_* flags in 'flags'
*/
var = GNode_FindVar(ctxt, name, nameHash);
-
- if (var == NULL && elsewhere && ctxt != VAR_CMDLINE)
+ if (!elsewhere)
+ return var;
+
+ if (var == NULL && ctxt != VAR_CMDLINE)
var = GNode_FindVar(VAR_CMDLINE, name, nameHash);
- if (!opts.checkEnvFirst && var == NULL && elsewhere && ctxt != VAR_GLOBAL) {
+ if (!opts.checkEnvFirst && var == NULL && ctxt != VAR_GLOBAL) {
var = GNode_FindVar(VAR_GLOBAL, name, nameHash);
if (var == NULL && ctxt != VAR_INTERNAL) {
/* VAR_INTERNAL is subordinate to VAR_GLOBAL */
@@ -389,7 +391,7 @@
}
}
- if (var == NULL && elsewhere) {
+ if (var == NULL) {
char *env;
if ((env = getenv(name)) != NULL) {
@@ -397,7 +399,7 @@
return VarNew(varname, varname, env, VAR_FROM_ENV);
}
- if (opts.checkEnvFirst && elsewhere && ctxt != VAR_GLOBAL) {
+ if (opts.checkEnvFirst && ctxt != VAR_GLOBAL) {
var = GNode_FindVar(VAR_GLOBAL, name, nameHash);
if (var == NULL && ctxt != VAR_INTERNAL)
var = GNode_FindVar(VAR_INTERNAL, name, nameHash);
Home |
Main Index |
Thread Index |
Old Index