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 CmdOpts.va...
details: https://anonhg.NetBSD.org/src/rev/b574ec5628d2
branches: trunk
changeset: 946481:b574ec5628d2
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Nov 28 23:35:44 2020 +0000
description:
make(1): reduce memory allocation in CmdOpts.variables
diffstat:
usr.bin/make/main.c | 12 ++++++------
usr.bin/make/make.h | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
diffs (72 lines):
diff -r 9492cc295502 -r b574ec5628d2 usr.bin/make/main.c
--- a/usr.bin/make/main.c Sat Nov 28 23:32:22 2020 +0000
+++ b/usr.bin/make/main.c Sat Nov 28 23:35:44 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.484 2020/11/28 23:32:22 rillig Exp $ */
+/* $NetBSD: main.c,v 1.485 2020/11/28 23:35:44 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.484 2020/11/28 23:32:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.485 2020/11/28 23:35:44 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -500,7 +500,7 @@
case 'V':
case 'v':
opts.printVars = c == 'v' ? PVM_EXPANDED : PVM_UNEXPANDED;
- Lst_Append(opts.variables, bmake_strdup(argvalue));
+ Lst_Append(&opts.variables, bmake_strdup(argvalue));
/* XXX: Why always -V? */
Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL);
Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL);
@@ -904,7 +904,7 @@
else
expandVars = GetBooleanVar(".MAKE.EXPAND_VARIABLES", FALSE);
- for (ln = opts.variables->first; ln != NULL; ln = ln->next) {
+ for (ln = opts.variables.first; ln != NULL; ln = ln->next) {
const char *varname = ln->datum;
PrintVar(varname, expandVars);
}
@@ -1137,7 +1137,7 @@
opts.beSilent = FALSE; /* Print commands as executed */
opts.touchFlag = FALSE; /* Actually update targets */
opts.printVars = PVM_NONE;
- opts.variables = Lst_New();
+ Lst_Init(&opts.variables);
opts.parseWarnFatal = FALSE;
opts.enterFlag = FALSE;
opts.varNoExportEnv = FALSE;
@@ -1621,7 +1621,7 @@
main_CleanUp(void)
{
#ifdef CLEANUP
- Lst_Destroy(opts.variables, free);
+ Lst_DoneCall(&opts.variables, free);
/*
* Don't free the actual strings from opts.makefiles, they may be
* used in GNodes.
diff -r 9492cc295502 -r b574ec5628d2 usr.bin/make/make.h
--- a/usr.bin/make/make.h Sat Nov 28 23:32:22 2020 +0000
+++ b/usr.bin/make/make.h Sat Nov 28 23:35:44 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.226 2020/11/28 23:32:22 rillig Exp $ */
+/* $NetBSD: make.h,v 1.227 2020/11/28 23:35:44 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -671,7 +671,7 @@
/* -[Vv]: print expanded or unexpanded selected variables */
PrintVarsMode printVars;
/* -[Vv]: the variables to print */
- StringList *variables;
+ StringList variables;
/* -W: if true, makefile parsing warnings are treated as errors */
Boolean parseWarnFatal;
Home |
Main Index |
Thread Index |
Old Index