Module Name:    src
Committed By:   rillig
Date:           Fri Sep 25 14:49:51 UTC 2020

Modified Files:
        src/usr.bin/make: arch.c

Log Message:
make(1): inline ArchFindArchive into ArchStatMember

This avoids a few void pointers and unnecessary function calls.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/usr.bin/make/arch.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/arch.c
diff -u src/usr.bin/make/arch.c:1.120 src/usr.bin/make/arch.c:1.121
--- src/usr.bin/make/arch.c:1.120	Fri Sep 25 14:41:35 2020
+++ src/usr.bin/make/arch.c	Fri Sep 25 14:49:51 2020
@@ -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 @@ Arch_ParseArchive(char **linePtr, GNodeL
     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 @@ ArchStatMember(const char *archive, cons
 	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);
 

Reply via email to