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



details:   https://anonhg.NetBSD.org/src/rev/c95c32236533
branches:  trunk
changeset: 1016712:c95c32236533
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 28 23:43:14 2020 +0000

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

diffstat:

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

diffs (50 lines):

diff -r 7b13a366b4da -r c95c32236533 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sat Nov 28 23:39:58 2020 +0000
+++ b/usr.bin/make/main.c       Sat Nov 28 23:43:14 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.486 2020/11/28 23:39:58 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.487 2020/11/28 23:43:14 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.486 2020/11/28 23:39:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.487 2020/11/28 23:43:14 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -1210,25 +1210,25 @@
 ReadBuiltinRules(void)
 {
        StringListNode *ln;
-       StringList *sysMkPath = Lst_New();
+       StringList sysMkPath = LST_INIT;
 
        Dir_Expand(_PATH_DEFSYSMK,
            Lst_IsEmpty(sysIncPath) ? defSysIncPath : sysIncPath,
-           sysMkPath);
-       if (Lst_IsEmpty(sysMkPath))
+           &sysMkPath);
+       if (Lst_IsEmpty(&sysMkPath))
                Fatal("%s: no system rules (%s).", progname, _PATH_DEFSYSMK);
 
-       for (ln = sysMkPath->first; ln != NULL; ln = ln->next)
+       for (ln = sysMkPath.first; ln != NULL; ln = ln->next)
                if (ReadMakefile(ln->datum) == 0)
                        break;
 
        if (ln == NULL)
                Fatal("%s: cannot open %s.",
-                   progname, (const char *)sysMkPath->first->datum);
+                   progname, (const char *)sysMkPath.first->datum);
 
        /* Free the list but not the actual filenames since these may still
         * be used in GNodes. */
-       Lst_Free(sysMkPath);
+       Lst_Done(&sysMkPath);
 }
 
 static void



Home | Main Index | Thread Index | Old Index