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 ExpandWild...



details:   https://anonhg.NetBSD.org/src/rev/65d1cd84e372
branches:  trunk
changeset: 978688:65d1cd84e372
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 29 01:19:11 2020 +0000

description:
make(1): reduce memory allocation in ExpandWildcards for suffixes

diffstat:

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

diffs (56 lines):

diff -r 0efa77133352 -r 65d1cd84e372 usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Sun Nov 29 01:16:37 2020 +0000
+++ b/usr.bin/make/suff.c       Sun Nov 29 01:19:11 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.319 2020/11/29 01:16:37 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.320 2020/11/29 01:19:11 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*     "@(#)suff.c     8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.319 2020/11/29 01:16:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.320 2020/11/29 01:19:11 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -1182,7 +1182,7 @@
 ExpandWildcards(GNodeListNode *cln, GNode *pgn)
 {
     GNode *cgn = cln->datum;
-    StringList *expansions;
+    StringList expansions;
 
     if (!Dir_HasWildcards(cgn->name))
        return;
@@ -1190,15 +1190,15 @@
     /*
      * Expand the word along the chosen path
      */
-    expansions = Lst_New();
-    Dir_Expand(cgn->name, Suff_FindPath(cgn), expansions);
+    Lst_Init(&expansions);
+    Dir_Expand(cgn->name, Suff_FindPath(cgn), &expansions);
 
-    while (!Lst_IsEmpty(expansions)) {
+    while (!Lst_IsEmpty(&expansions)) {
        GNode   *gn;
        /*
         * Fetch next expansion off the list and find its GNode
         */
-       char *cp = Lst_Dequeue(expansions);
+       char *cp = Lst_Dequeue(&expansions);
 
        SUFF_DEBUG1("%s...", cp);
        gn = Targ_GetNode(cp);
@@ -1209,7 +1209,7 @@
        pgn->unmade++;
     }
 
-    Lst_Free(expansions);
+    Lst_Done(&expansions);
 
     SUFF_DEBUG0("\n");
 



Home | Main Index | Thread Index | Old Index