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): fix performance problem in specially c...



details:   https://anonhg.NetBSD.org/src/rev/920b93ae7961
branches:  trunk
changeset: 934660:920b93ae7961
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jun 15 14:46:28 2020 +0000

description:
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.

diffstat:

 usr.bin/make/str.c                  |  8 +++++---
 usr.bin/make/unit-tests/modmatch.mk |  2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diffs (44 lines):

diff -r eb7e494a6600 -r 920b93ae7961 usr.bin/make/str.c
--- a/usr.bin/make/str.c        Mon Jun 15 14:32:07 2020 +0000
+++ b/usr.bin/make/str.c        Mon Jun 15 14:46:28 2020 +0000
@@ -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 @@
                 */
                if (*pattern == '*') {
                        pattern++;
+                       while (*pattern == '*')
+                               pattern++;
                        if (*pattern == 0)
                                return 1;
                        while (*string != 0) {
diff -r eb7e494a6600 -r 920b93ae7961 usr.bin/make/unit-tests/modmatch.mk
--- a/usr.bin/make/unit-tests/modmatch.mk       Mon Jun 15 14:32:07 2020 +0000
+++ b/usr.bin/make/unit-tests/modmatch.mk       Mon Jun 15 14:46:28 2020 +0000
@@ -36,4 +36,4 @@
 # 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}



Home | Main Index | Thread Index | Old Index