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): inline ArchFindArchive into ArchStatMe...



details:   https://anonhg.NetBSD.org/src/rev/faa54a07b4ad
branches:  trunk
changeset: 944274:faa54a07b4ad
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Sep 25 14:49:51 2020 +0000

description:
make(1): inline ArchFindArchive into ArchStatMember

This avoids a few void pointers and unnecessary function calls.

diffstat:

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

diffs (47 lines):

diff -r 6ef1995f0f3b -r faa54a07b4ad usr.bin/make/arch.c
--- a/usr.bin/make/arch.c       Fri Sep 25 14:41:35 2020 +0000
+++ b/usr.bin/make/arch.c       Fri Sep 25 14:49:51 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arch.c,v 1.120 2020/09/25 14:41:35 rillig Exp $        */
+/*     $NetBSD: arch.c,v 1.121 2020/09/25 14:49:51 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -133,7 +133,7 @@
 #include    "config.h"
 
 /*     "@(#)arch.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: arch.c,v 1.120 2020/09/25 14:41:35 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.121 2020/09/25 14:49:51 rillig Exp $");
 
 #ifdef TARGET_MACHINE
 #undef MAKE_MACHINE
@@ -437,14 +437,6 @@
     return TRUE;
 }
 
-/* See if the given archive is the one we are looking for.
- * Called via Lst_Find. */
-static Boolean
-ArchFindArchive(const void *ar, const void *desiredName)
-{
-    return strcmp(((const Arch *)ar)->name, desiredName) == 0;
-}
-
 /*-
  *-----------------------------------------------------------------------
  * ArchStatMember --
@@ -490,7 +482,12 @@
        member = base + 1;
     }
 
-    ln = Lst_Find(archives, ArchFindArchive, archive);
+    for (ln = archives->first; ln != NULL; ln = ln->next) {
+       const Arch *archPtr = ln->datum;
+       if (strcmp(archPtr->name, archive) == 0)
+           break;
+    }
+
     if (ln != NULL) {
        ar = LstNode_Datum(ln);
 



Home | Main Index | Thread Index | Old Index