summaryrefslogtreecommitdiff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2014-09-08 16:38:51 +0100
committerPeter Stephenson <pws@zsh.org>2014-09-08 16:38:51 +0100
commit8bf3595e3a05f0cea7f12c463a0df09e4010cd1c (patch)
tree1dd75aa5b3921cee250da7c2db2d2b91dbf939ca /Src
parent956829c18e8ade666083f1c69043a16a80f70b0d (diff)
downloadzsh-8bf3595e3a05f0cea7f12c463a0df09e4010cd1c.tar.gz
zsh-8bf3595e3a05f0cea7f12c463a0df09e4010cd1c.zip
users/19059 based on users/19058: remove ineffiency with multiple * matches
Diffstat (limited to 'Src')
-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:
/*