Module Name:    src
Committed By:   rillig
Date:           Sun Oct 25 07:57:01 UTC 2020

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

Log Message:
make(1): make Arch_FindLib simpler


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 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.145 src/usr.bin/make/arch.c:1.146
--- src/usr.bin/make/arch.c:1.145	Sat Oct 24 04:20:50 2020
+++ src/usr.bin/make/arch.c	Sun Oct 25 07:57:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.145 2020/10/24 04:20:50 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.146 2020/10/25 07:57:01 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.145 2020/10/24 04:20:50 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.146 2020/10/25 07:57:01 rillig Exp $");
 
 #ifdef TARGET_MACHINE
 #undef MAKE_MACHINE
@@ -993,19 +993,12 @@ Arch_MemMTime(GNode *gn)
  *
  * Input:
  *	gn		Node of library to find
- *	path		Search path
  */
 void
 Arch_FindLib(GNode *gn, SearchPath *path)
 {
-    char *libName;		/* file name for archive */
-    size_t sz = strlen(gn->name) + 6 - 2;
-
-    libName = bmake_malloc(sz);
-    snprintf(libName, sz, "lib%s.a", &gn->name[2]);
-
+    char *libName = str_concat3("lib", gn->name + 2, ".a");
     gn->path = Dir_FindFile(libName, path);
-
     free(libName);
 
 #ifdef LIBRARIES

Reply via email to