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/8f0c81fca768
branches:  trunk
changeset: 945152:8f0c81fca768
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Oct 22 20:00:13 2020 +0000

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

diffstat:

 usr.bin/make/make.c |  16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diffs (58 lines):

diff -r bf8986076734 -r 8f0c81fca768 usr.bin/make/make.c
--- a/usr.bin/make/make.c       Thu Oct 22 19:55:14 2020 +0000
+++ b/usr.bin/make/make.c       Thu Oct 22 20:00:13 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.c,v 1.169 2020/10/22 17:29:32 rillig Exp $        */
+/*     $NetBSD: make.c,v 1.170 2020/10/22 20:00:13 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.169 2020/10/22 17:29:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.170 2020/10/22 20:00:13 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -606,6 +606,7 @@
     const char *cname;         /* the child's name */
     time_t     mtime = -1;
     GNodeList *parents;
+    GNodeListNode *ln;
     GNode      *centurion;
 
     /* It is save to re-examine any nodes again */
@@ -647,13 +648,8 @@
     Lst_ForEachUntil(centurion->order_succ, MakeBuildParent, toBeMade->first);
 
     /* Now mark all the parents as having one less unmade child */
-    Lst_Open(parents);
-    for (;;) {
-       GNodeListNode *ln = Lst_Next(parents);
-       GNode *pgn;
-       if (ln == NULL)
-           break;
-       pgn = ln->datum;
+    for (ln = parents->first; ln != NULL; ln = ln->next) {
+       GNode *pgn = ln->datum;
 
        if (DEBUG(MAKE))
            debug_printf("inspect parent %s%s: flags %x, "
@@ -739,7 +735,6 @@
        pgn->made = REQUESTED;
        Lst_Enqueue(toBeMade, pgn);
     }
-    Lst_Close(parents);
 
     UpdateImplicitParentsVars(cgn, cname);
 }
@@ -871,6 +866,7 @@
 
     if (bn->made >= MADE || !(bn->flags & REMAKE))
        return 0;
+
     DEBUG2(MAKE, "MakeCheckOrder: Waiting for .ORDER node %s%s\n",
           bn->name, bn->cohort_num);
     return 1;



Home | Main Index | Thread Index | Old Index