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: skip memcpy when parsing but not evaluati...



details:   https://anonhg.NetBSD.org/src/rev/5543926ba20a
branches:  trunk
changeset: 981546:5543926ba20a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 14 18:08:25 2021 +0000

description:
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.

diffstat:

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

diffs (28 lines):

diff -r e819bae2610f -r 5543926ba20a usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Mar 14 18:02:44 2021 +0000
+++ b/usr.bin/make/var.c        Sun Mar 14 18:08:25 2021 +0000
@@ -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 @@
 
                        (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;
                }



Home | Main Index | Thread Index | Old Index