Module Name: src Committed By: rillig Date: Sat Nov 28 23:45:25 UTC 2020
Modified Files: src/usr.bin/make: make.c Log Message: make(1): reduce memory allocation in Make_ExpandUse To generate a diff of this commit: cvs rdiff -u -r1.223 -r1.224 src/usr.bin/make/make.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/make.c diff -u src/usr.bin/make/make.c:1.223 src/usr.bin/make/make.c:1.224 --- src/usr.bin/make/make.c:1.223 Sat Nov 28 19:22:32 2020 +++ src/usr.bin/make/make.c Sat Nov 28 23:45:25 2020 @@ -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 @@ ExamineLater(GNodeList *examine, GNodeLi 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 @@ Make_ExpandUse(GNodeList *targs) * 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 @@ Make_ExpandUse(GNodeList *targs) 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 @@ Make_ExpandUse(GNodeList *targs) } 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 */