summary refs log tree commit diff
path: root/Src/pattern.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/pattern.c')
-rw-r--r--Src/pattern.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Src/pattern.c b/Src/pattern.c
index 94a299ebb..df5e602ca 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -3012,6 +3012,16 @@ patmatch(Upat prog)
 	    break;
 	case P_STAR:
 	    /* Handle specially for speed, although really P_ONEHASH+P_ANY */
+	    while (P_OP(next) == P_STAR) {
+		/*
+		 * If there's another * following we can optimise it
+		 * out.  Chains of *'s can give pathologically bad
+		 * performance.
+		 */
+		scan = next;
+		next = PATNEXT(scan);
+	    }
+	    /*FALLTHROUGH*/
 	case P_ONEHASH:
 	case P_TWOHASH:
 	    /*