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): replace Lst_Open with simple iteration...



details:   https://anonhg.NetBSD.org/src/rev/4ca85aa00a64
branches:  trunk
changeset: 941079:4ca85aa00a64
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Oct 18 14:58:45 2020 +0000

description:
make(1): replace Lst_Open with simple iteration in Make_HandleUse

diffstat:

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

diffs (50 lines):

diff -r eb9cedc52a05 -r 4ca85aa00a64 usr.bin/make/make.c
--- a/usr.bin/make/make.c       Sun Oct 18 14:36:43 2020 +0000
+++ b/usr.bin/make/make.c       Sun Oct 18 14:58:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.c,v 1.160 2020/10/18 13:02:10 rillig Exp $        */
+/*     $NetBSD: make.c,v 1.161 2020/10/18 14:58:45 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -107,7 +107,7 @@
 #include    "job.h"
 
 /*     "@(#)make.c     8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: make.c,v 1.160 2020/10/18 13:02:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.161 2020/10/18 14:58:45 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -386,8 +386,9 @@
  * has commands.
  *
  * Input:
- *     cgn             The .USE node
- *     pgn             The target of the .USE node
+ *     cgn             The source node, which is either a .USE/.USEBEFORE
+ *                     node or a transformation node (OP_TRANSFORM).
+ *     pgn             The target node
  */
 void
 Make_HandleUse(GNode *cgn, GNode *pgn)
@@ -411,9 +412,8 @@
            }
     }
 
-    Lst_Open(cgn->children);
-    while ((ln = Lst_Next(cgn->children)) != NULL) {
-       GNode *gn = LstNode_Datum(ln);
+    for (ln = cgn->children->first; ln != NULL; ln = ln->next) {
+       GNode *gn = ln->datum;
 
        /*
         * Expand variables in the .USE node's name
@@ -439,7 +439,6 @@
        Lst_Append(gn->parents, pgn);
        pgn->unmade++;
     }
-    Lst_Close(cgn->children);
 
     pgn->type |= cgn->type & ~(OP_OPMASK|OP_USE|OP_USEBEFORE|OP_TRANSFORM);
 }



Home | Main Index | Thread Index | Old Index