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/5d11825401f9
branches:  trunk
changeset: 955975:5d11825401f9
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 69293807edcc -r 5d11825401f9 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