1
Author: Upstream (proposed by Per Cederqvist <ceder@lysator.liu.se>)
2
Description: The patch fixes regression with very slow regexp pattern
3
processing which were converted into too complex glob patterns.
4
The regression was added in version 5.44.
5
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=591695
6
Bug-Upstream: http://sourceforge.net/tracker/?func=detail&atid=113179&aid=3010684&group_id=13179
8
Last-updated: Sun, 05 Sep 2010 09:35:03 +0400
10
--- expect-5.44.1.15.orig/retoglob.c
11
+++ expect-5.44.1.15/retoglob.c
17
+ExpCountStar _ANSI_ARGS_ ((Tcl_UniChar* src, Tcl_UniChar* last));
21
xxx (Tcl_UniChar* x, int xl)
24
LOG (stderr,"ST '%s'\n",xxx(out,nexto-out)); FF;
27
+ * Heuristic: if there are more than two *s, the risk is far too
28
+ * large that the result actually is slower than the normal re
29
+ * matching. So bail out.
31
+ if (ExpCountStar (out,nexto) > 2) {
36
* Check if the result is actually useful.
37
* Empty or just a *, or ? are not. A series
38
* of ?'s is borderline, as they semi-count
44
+ExpCountStar (src, last)
51
+ /* Count number of *'s. State machine. The complexity is due to the
52
+ * need of handling escaped characters.
55
+ for (; src < last; src++) {
58
+ } else if (*src == '\\') {
60
+ } else if (*src == '*') {