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): reduce memory allocation in Make_Expan...



details:   https://anonhg.NetBSD.org/src/rev/feb4c6cf3729
branches:  trunk
changeset: 957454:feb4c6cf3729
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 28 23:45:25 2020 +0000

description:
make(1): reduce memory allocation in Make_ExpandUse

diffstat:

 usr.bin/make/make.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (62 lines):

diff -r 9898e430faa5 -r feb4c6cf3729 usr.bin/make/make.c
--- a/usr.bin/make/make.c       Sat Nov 28 23:43:14 2020 +0000
+++ b/usr.bin/make/make.c       Sat Nov 28 23:45:25 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.c,v 1.223 2020/11/28 19:22:32 rillig Exp $        */
+/*     $NetBSD: make.c,v 1.224 2020/11/28 23:45:25 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -102,7 +102,7 @@
 #include "job.h"
 
 /*     "@(#)make.c     8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: make.c,v 1.223 2020/11/28 19:22:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.224 2020/11/28 23:45:25 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked_seqno = 1;
@@ -1141,8 +1141,8 @@
 void
 Make_ExpandUse(GNodeList *targs)
 {
-    GNodeList *examine = Lst_New();    /* Queue of targets to examine */
-    Lst_AppendAll(examine, targs);
+    GNodeList examine = LST_INIT;      /* Queue of targets to examine */
+    Lst_AppendAll(&examine, targs);
 
     /*
      * Make an initial downward pass over the graph, marking nodes to be made
@@ -1152,8 +1152,8 @@
      * be looked at in a minute, otherwise we add its children to our queue
      * and go on about our business.
      */
-    while (!Lst_IsEmpty(examine)) {
-       GNode *gn = Lst_Dequeue(examine);
+    while (!Lst_IsEmpty(&examine)) {
+       GNode *gn = Lst_Dequeue(&examine);
 
        if (gn->flags & REMAKE)
            /* We've looked at this one already */
@@ -1163,7 +1163,7 @@
               gn->name, gn->cohort_num);
 
        if (gn->type & OP_DOUBLEDEP)
-           Lst_PrependAll(examine, &gn->cohorts);
+           Lst_PrependAll(&examine, &gn->cohorts);
 
        /*
         * Apply any .USE rules before looking for implicit dependencies
@@ -1199,10 +1199,10 @@
        }
 
        if (gn->unmade != 0)
-           ExamineLater(examine, &gn->children);
+           ExamineLater(&examine, &gn->children);
     }
 
-    Lst_Free(examine);
+    Lst_Done(&examine);
 }
 
 /* Make the .WAIT node depend on the previous children */



Home | Main Index | Thread Index | Old Index