Module Name: src
Committed By: rillig
Date: Sun Mar 14 18:08:25 UTC 2021
Modified Files:
src/usr.bin/make: var.c
Log Message:
make: skip memcpy when parsing but not evaluating ':D' and ':U'
No functional change, just a tiny bit of performance improvement,
probably not even measurable. Having the code nevertheless serves as a
copy-and-paste template for implementing other modifiers that might
perform more costly tasks.
To generate a diff of this commit:
cvs rdiff -u -r1.870 -r1.871 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.870 src/usr.bin/make/var.c:1.871
--- src/usr.bin/make/var.c:1.870 Sun Mar 14 18:02:44 2021
+++ src/usr.bin/make/var.c Sun Mar 14 18:08:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.870 2021/03/14 18:02:44 rillig Exp $ */
+/* $NetBSD: var.c,v 1.871 2021/03/14 18:08:25 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.870 2021/03/14 18:02:44 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.871 2021/03/14 18:08:25 rillig Exp $");
typedef enum VarFlags {
VFL_NONE = 0,
@@ -2488,7 +2488,8 @@ ApplyModifier_Defined(const char **pp, A
(void)Var_Parse(&p, expr->scope, eflags, &nested_val);
/* TODO: handle errors */
- Buf_AddStr(&buf, nested_val.str);
+ if (expr->eflags & VARE_WANTRES)
+ Buf_AddStr(&buf, nested_val.str);
FStr_Done(&nested_val);
continue;
}