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): migrate ArchFree from Hash_Search to H...



details:   https://anonhg.NetBSD.org/src/rev/73c4005f8bc6
branches:  trunk
changeset: 1015234:73c4005f8bc6
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Oct 18 12:00:16 2020 +0000

description:
make(1): migrate ArchFree from Hash_Search to HashIter

diffstat:

 usr.bin/make/arch.c |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (38 lines):

diff -r 655965b1c019 -r 73c4005f8bc6 usr.bin/make/arch.c
--- a/usr.bin/make/arch.c       Sun Oct 18 12:00:12 2020 +0000
+++ b/usr.bin/make/arch.c       Sun Oct 18 12:00:16 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arch.c,v 1.133 2020/10/17 21:32:30 rillig Exp $        */
+/*     $NetBSD: arch.c,v 1.134 2020/10/18 12:00:16 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include    "config.h"
 
 /*     "@(#)arch.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: arch.c,v 1.133 2020/10/17 21:32:30 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.134 2020/10/18 12:00:16 rillig Exp $");
 
 #ifdef TARGET_MACHINE
 #undef MAKE_MACHINE
@@ -166,14 +166,13 @@
 ArchFree(void *ap)
 {
     Arch *a = (Arch *)ap;
-    Hash_Search search;
-    Hash_Entry *entry;
+    HashIter hi;
+    Hash_Entry *he;
 
     /* Free memory from hash entries */
-    for (entry = Hash_EnumFirst(&a->members, &search);
-        entry != NULL;
-        entry = Hash_EnumNext(&search))
-       free(Hash_GetValue(entry));
+    HashIter_Init(&hi, &a->members);
+    while ((he = HashIter_Next(&hi)) != NULL)
+       free(Hash_GetValue(he));
 
     free(a->name);
     free(a->fnametab);



Home | Main Index | Thread Index | Old Index