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: when expanding nested variables, check si...



details:   https://anonhg.NetBSD.org/src/rev/903390a95cb3
branches:  trunk
changeset: 359814:903390a95cb3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jan 24 20:49:55 2022 +0000

description:
make: when expanding nested variables, check simple things first

No functional change, just a little performance improvement for
expressions that are not evaluated anyway but only parsed.

diffstat:

 usr.bin/make/var.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 572b26138a19 -r 903390a95cb3 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Mon Jan 24 09:42:13 2022 +0000
+++ b/usr.bin/make/var.c        Mon Jan 24 20:49:55 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.1002 2022/01/15 19:05:23 rillig Exp $        */
+/*     $NetBSD: var.c,v 1.1003 2022/01/24 20:49:55 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1002 2022/01/15 19:05:23 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1003 2022/01/24 20:49:55 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -4545,8 +4545,8 @@
         * Before applying any modifiers, expand any nested expressions from
         * the variable value.
         */
-       if (strchr(Expr_Str(&expr), '$') != NULL &&
-           VarEvalMode_ShouldEval(emode)) {
+       if (VarEvalMode_ShouldEval(emode) &&
+           strchr(Expr_Str(&expr), '$') != NULL) {
                char *expanded;
                VarEvalMode nested_emode = emode;
                if (opts.strict)



Home | Main Index | Thread Index | Old Index