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 Str_FindSubstring in ModifyWord...



details:   https://anonhg.NetBSD.org/src/rev/e4a5f815fd71
branches:  trunk
changeset: 944549:e4a5f815fd71
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Oct 03 14:41:20 2020 +0000

description:
make(1): inline Str_FindSubstring in ModifyWord_Subst

diffstat:

 usr.bin/make/var.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 0c06bd158901 -r e4a5f815fd71 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sat Oct 03 14:39:36 2020 +0000
+++ b/usr.bin/make/var.c        Sat Oct 03 14:41:20 2020 +0000
@@ -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 @@
        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;



Home | Main Index | Thread Index | Old Index