Module Name: src Committed By: rillig Date: Mon Jun 15 14:46:28 UTC 2020
Modified Files: src/usr.bin/make: str.c src/usr.bin/make/unit-tests: modmatch.mk Log Message: make(1): fix performance problem in specially crafted :M modifier This fix was previously suspected to make the vax build fail. The next build succeeded though, and it started 2 hours before this fix was reverted. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/usr.bin/make/str.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/modmatch.mk 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/str.c diff -u src/usr.bin/make/str.c:1.47 src/usr.bin/make/str.c:1.48 --- src/usr.bin/make/str.c:1.47 Sun Jun 14 23:13:21 2020 +++ src/usr.bin/make/str.c Mon Jun 15 14:46:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: str.c,v 1.47 2020/06/14 23:13:21 rillig Exp $ */ +/* $NetBSD: str.c,v 1.48 2020/06/15 14:46:28 rillig Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: str.c,v 1.47 2020/06/14 23:13:21 rillig Exp $"; +static char rcsid[] = "$NetBSD: str.c,v 1.48 2020/06/15 14:46:28 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90"; #else -__RCSID("$NetBSD: str.c,v 1.47 2020/06/14 23:13:21 rillig Exp $"); +__RCSID("$NetBSD: str.c,v 1.48 2020/06/15 14:46:28 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -355,6 +355,8 @@ Str_Match(const char *string, const char */ if (*pattern == '*') { pattern++; + while (*pattern == '*') + pattern++; if (*pattern == 0) return 1; while (*string != 0) { Index: src/usr.bin/make/unit-tests/modmatch.mk diff -u src/usr.bin/make/unit-tests/modmatch.mk:1.5 src/usr.bin/make/unit-tests/modmatch.mk:1.6 --- src/usr.bin/make/unit-tests/modmatch.mk:1.5 Sun Jun 14 23:13:21 2020 +++ src/usr.bin/make/unit-tests/modmatch.mk Mon Jun 15 14:46:28 2020 @@ -36,4 +36,4 @@ check-cclass: # Before 2020-06-13, this expression took quite a long time in Str_Match, # calling itself 601080390 times for 16 asterisks. slow: .PHONY -# @:;: ${:U****************:M****************b:Q} + @:;: ${:U****************:M****************b:Q}