summaryrefslogtreecommitdiffstats
path: root/generic/regcomp.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2015-09-21 18:22:46 (GMT)
committerdgp <dgp@users.sourceforge.net>2015-09-21 18:22:46 (GMT)
commitf0f0d2b1abf721e7cae3584cf4fc01cd5e0b9f66 (patch)
treeca934d0e44626b12d4c8aecaa178c2eb8e312973 /generic/regcomp.c
parent8dd9711e5b72a7dcc4ee36b04d6876afac3bd73e (diff)
parente4bb6f372f554b29e021e1ab90f875e27479f4a3 (diff)
downloadtcl-f0f0d2b1abf721e7cae3584cf4fc01cd5e0b9f66.zip
tcl-f0f0d2b1abf721e7cae3584cf4fc01cd5e0b9f66.tar.gz
tcl-f0f0d2b1abf721e7cae3584cf4fc01cd5e0b9f66.tar.bz2
[d7ea9f985][a3c3508599] Internal regexp fixes that cleanup and streamline.
Diffstat (limited to 'generic/regcomp.c')
-rw-r--r--generic/regcomp.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/generic/regcomp.c b/generic/regcomp.c
index d23076b..b1c02d8 100644
--- a/generic/regcomp.c
+++ b/generic/regcomp.c
@@ -593,13 +593,15 @@ makesearch(
break;
}
}
+
+ /*
+ * We want to mark states as being in the list already by having non
+ * NULL tmp fields, but we can't just store the old slist value in tmp
+ * because that doesn't work for the first such state. Instead, the
+ * first list entry gets its own address in tmp.
+ */
if (b != NULL && s->tmp == NULL) {
- /*
- * Must be split if not already in the list (fixes bugs 505048,
- * 230589, 840258, 504785).
- */
-
- s->tmp = slist;
+ s->tmp = (slist != NULL) ? slist : s;
slist = s;
}
}
@@ -620,7 +622,7 @@ makesearch(
freearc(nfa, a);
}
}
- s2 = s->tmp;
+ s2 = (s->tmp != s) ? s->tmp : NULL;
s->tmp = NULL; /* clean up while we're at it */
}
}