summaryrefslogtreecommitdiffstats
path: root/generic/regcomp.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-11-15 22:01:03 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-11-15 22:01:03 (GMT)
commitcdb09f0ded89acc8b7a6b269f50fc8cd15da9739 (patch)
treed9b1b39a8a0517ecc9bbd810273e0cb13e7ca980 /generic/regcomp.c
parenta4ad9e9083662f62f8f3df8f9901a114be5cbf24 (diff)
downloadtcl-cdb09f0ded89acc8b7a6b269f50fc8cd15da9739.zip
tcl-cdb09f0ded89acc8b7a6b269f50fc8cd15da9739.tar.gz
tcl-cdb09f0ded89acc8b7a6b269f50fc8cd15da9739.tar.bz2
* generic/regc_nfa.c: Fixed infinite loop in the regexp compiler
* generic/regcomp.c: [Bug 1810038]. Corrected looping logic in * tests/regexp.test: fixempties() to avoid wasting time walking a list of dead states [Bug 1832612]. Convert optst() from expensive no-op to a cheap no-op. Improve newline usage in debug output.
Diffstat (limited to 'generic/regcomp.c')
-rw-r--r--generic/regcomp.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/generic/regcomp.c b/generic/regcomp.c
index 29be00f..31b8a82 100644
--- a/generic/regcomp.c
+++ b/generic/regcomp.c
@@ -1837,14 +1837,14 @@ optst(v, t)
struct vars *v;
struct subre *t;
{
- if (t == NULL)
- return;
-
- /* recurse through children */
- if (t->left != NULL)
- optst(v, t->left);
- if (t->right != NULL)
- optst(v, t->right);
+ /*
+ * DGP (2007-11-13): I assume it was the programmer's intent to eventually
+ * come back and add code to optimize subRE trees, but the routine coded
+ * just spent effort traversing the tree and doing nothing. We can do
+ * nothing with less effort.
+ */
+
+ return;
}
/*
@@ -2144,8 +2144,8 @@ int nfapresent; /* is the original NFA still around? */
if (!NULLCNFA(t->cnfa)) {
fprintf(f, "\n");
dumpcnfa(&t->cnfa, f);
- fprintf(f, "\n");
}
+ fprintf(f, "\n");
if (t->left != NULL)
stdump(t->left, f, nfapresent);
if (t->right != NULL)