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(1): make .USEBEFORE handling simpler



details:   https://anonhg.NetBSD.org/src/rev/af333f821aaf
branches:  trunk
changeset: 1013171:af333f821aaf
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 22 11:57:18 2020 +0000

description:
make(1): make .USEBEFORE handling simpler

There is no need to duplicate the list of .USEBEFORE commands, just to
destroy that list immediately.  Instead, it's simpler to just prepend
the commands from the .USEBEFORE node to the parent.

diffstat:

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

diffs (42 lines):

diff -r c2aebcedeff0 -r af333f821aaf usr.bin/make/make.c
--- a/usr.bin/make/make.c       Sat Aug 22 11:53:18 2020 +0000
+++ b/usr.bin/make/make.c       Sat Aug 22 11:57:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.c,v 1.110 2020/08/22 11:35:00 rillig Exp $        */
+/*     $NetBSD: make.c,v 1.111 2020/08/22 11:57:18 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: make.c,v 1.110 2020/08/22 11:35:00 rillig Exp $";
+static char rcsid[] = "$NetBSD: make.c,v 1.111 2020/08/22 11:57:18 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)make.c     8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: make.c,v 1.110 2020/08/22 11:35:00 rillig Exp $");
+__RCSID("$NetBSD: make.c,v 1.111 2020/08/22 11:57:18 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -443,10 +443,11 @@
                 * .USEBEFORE --
                 *      prepend the child's commands to the parent.
                 */
-               Lst cmds = pgn->commands;
-               pgn->commands = Lst_Duplicate(cgn->commands, NULL);
-               (void)Lst_Concat(pgn->commands, cmds, LST_CONCNEW);
-               Lst_Destroy(cmds, NULL);
+               LstNode node;
+               for (node = Lst_Last(cgn->commands);
+                    node != NULL;
+                    node = Lst_Prev(node))
+                   Lst_AtFront(pgn->commands, Lst_Datum(node));
            } else {
                /*
                 * .USE or target has no commands --



Home | Main Index | Thread Index | Old Index