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: eliminate common subexpressions in DebugF...



details:   https://anonhg.NetBSD.org/src/rev/7f7a34a9caca
branches:  trunk
changeset: 1026555:7f7a34a9caca
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 28 17:26:07 2021 +0000

description:
make: eliminate common subexpressions in DebugFailedJob

No functional change.

diffstat:

 usr.bin/make/job.c |  21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diffs (42 lines):

diff -r 1a6a122a35c2 -r 7f7a34a9caca usr.bin/make/job.c
--- a/usr.bin/make/job.c        Sun Nov 28 17:20:39 2021 +0000
+++ b/usr.bin/make/job.c        Sun Nov 28 17:26:07 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.438 2021/11/28 17:20:39 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.439 2021/11/28 17:26:07 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
 #include "trace.h"
 
 /*     "@(#)job.c      8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.438 2021/11/28 17:20:39 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.439 2021/11/28 17:26:07 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1072,15 +1072,14 @@
        debug_printf("*** Failed target: %s\n", job->node->name);
        debug_printf("*** Failed commands:\n");
        for (ln = job->node->commands.first; ln != NULL; ln = ln->next) {
-               const char *unexpanded = (const char *)ln->datum;
-               debug_printf("\t%s\n", unexpanded);
-
-               if (strchr(unexpanded, '$') != NULL) {
-                       char *expanded;
-                       (void)Var_Subst((const char *)ln->datum, job->node,
-                           VARE_WANTRES, &expanded);
-                       debug_printf("\t=> %s\n", expanded);
-                       free(expanded);
+               const char *cmd = ln->datum;
+               debug_printf("\t%s\n", cmd);
+
+               if (strchr(cmd, '$') != NULL) {
+                       char *xcmd;
+                       (void)Var_Subst(cmd, job->node, VARE_WANTRES, &xcmd);
+                       debug_printf("\t=> %s\n", xcmd);
+                       free(xcmd);
                }
        }
 }



Home | Main Index | Thread Index | Old Index