Module Name: src Committed By: rillig Date: Mon Jan 24 20:49:55 UTC 2022
Modified Files: src/usr.bin/make: var.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.1002 -r1.1003 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/var.c diff -u src/usr.bin/make/var.c:1.1002 src/usr.bin/make/var.c:1.1003 --- src/usr.bin/make/var.c:1.1002 Sat Jan 15 19:05:23 2022 +++ src/usr.bin/make/var.c Mon Jan 24 20:49:55 2022 @@ -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 @@ Var_Parse(const char **pp, GNode *scope, * 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)