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 suffix can...



details:   https://anonhg.NetBSD.org/src/rev/8b28c814f1ca
branches:  trunk
changeset: 946492:8b28c814f1ca
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 29 01:12:45 2020 +0000

description:
make(1): reduce memory allocation in suffix candidate search

diffstat:

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

diffs (81 lines):

diff -r 4d7147bc052a -r 8b28c814f1ca usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Sun Nov 29 01:10:08 2020 +0000
+++ b/usr.bin/make/suff.c       Sun Nov 29 01:12:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.317 2020/11/29 01:10:08 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.318 2020/11/29 01:12:45 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.317 2020/11/29 01:10:08 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.318 2020/11/29 01:12:45 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -211,7 +211,7 @@
 
 typedef struct CandidateSearcher {
 
-    CandidateList *list;
+    CandidateList list;
 
     /*
      * TODO: Add HashSet for seen entries, to avoid endless loops such as
@@ -901,35 +901,35 @@
 static void
 CandidateSearcher_Init(CandidateSearcher *cs)
 {
-    cs->list = Lst_New();
+    Lst_Init(&cs->list);
 }
 
 static void
 CandidateSearcher_Done(CandidateSearcher *cs)
 {
-    Lst_Free(cs->list);
+    Lst_Done(&cs->list);
 }
 
 static void
 CandidateSearcher_Add(CandidateSearcher *cs, Candidate *cand)
 {
     /* TODO: filter duplicates */
-    Lst_Append(cs->list, cand);
+    Lst_Append(&cs->list, cand);
 }
 
 static void
 CandidateSearcher_AddIfNew(CandidateSearcher *cs, Candidate *cand)
 {
     /* TODO: filter duplicates */
-    if (Lst_FindDatum(cs->list, cand) == NULL)
-       Lst_Append(cs->list, cand);
+    if (Lst_FindDatum(&cs->list, cand) == NULL)
+       Lst_Append(&cs->list, cand);
 }
 
 static void
 CandidateSearcher_MoveAll(CandidateSearcher *cs, CandidateList *list)
 {
     /* TODO: filter duplicates */
-    Lst_MoveAll(cs->list, list);
+    Lst_MoveAll(&cs->list, list);
 }
 
 
@@ -1967,9 +1967,9 @@
 static void
 CandidateSearcher_CleanUp(CandidateSearcher *cs)
 {
-    while (RemoveCandidate(cs->list))
+    while (RemoveCandidate(&cs->list))
        continue;
-    assert(Lst_IsEmpty(cs->list));
+    assert(Lst_IsEmpty(&cs->list));
 }
 
 



Home | Main Index | Thread Index | Old Index