Module Name: src
Committed By: rillig
Date: Sat Oct 3 14:41:20 UTC 2020
Modified Files:
src/usr.bin/make: var.c
Log Message:
make(1): inline Str_FindSubstring in ModifyWord_Subst
To generate a diff of this commit:
cvs rdiff -u -r1.562 -r1.563 src/usr.bin/make/var.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/var.c
diff -u src/usr.bin/make/var.c:1.562 src/usr.bin/make/var.c:1.563
--- src/usr.bin/make/var.c:1.562 Sat Oct 3 12:51:49 2020
+++ src/usr.bin/make/var.c Sat Oct 3 14:41:20 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.562 2020/10/03 12:51:49 rillig Exp $ */
+/* $NetBSD: var.c,v 1.563 2020/10/03 14:41:20 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.562 2020/10/03 12:51:49 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.563 2020/10/03 14:41:20 rillig Exp $");
#define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
#define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -1292,8 +1292,11 @@ ModifyWord_Subst(const char *word, SepBu
return;
}
+ if (args->lhs[0] == '\0')
+ goto nosub;
+
/* unanchored case, may match more than once */
- while ((match = Str_FindSubstring(word, args->lhs)) != NULL) {
+ while ((match = strstr(word, args->lhs)) != NULL) {
SepBuf_AddBytesBetween(buf, word, match);
SepBuf_AddBytes(buf, args->rhs, args->rhsLen);
args->matched = TRUE;