diff options
author | dkf <dkf@noemail.net> | 2007-12-18 10:53:14 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2007-12-18 10:53:14 (GMT) |
commit | 89dcee88bee43586acd1910cdf537e5238c940a0 (patch) | |
tree | 73535333530cb8bb79ed8d41856c01d0f6dc4fd0 /generic/regc_color.c | |
parent | 6b67fc3de3834c7b50bde5cb66eb0458359d3bd3 (diff) | |
download | tcl-89dcee88bee43586acd1910cdf537e5238c940a0.zip tcl-89dcee88bee43586acd1910cdf537e5238c940a0.tar.gz tcl-89dcee88bee43586acd1910cdf537e5238c940a0.tar.bz2 |
Fixes for problems created when processing regular expressions that
generate very large automata. An enormous number of thanks to Will
Drewry <wad@google.com>, Tavis Ormandy <taviso@google.com>, and Tom
Lane <tgl@sss.pgh.pa.us> from the Postgresql crowd for their help in
tracking these problems down. [Bug 1810264]
FossilOrigin-Name: 8c98744456467a38e11dab4d25961ee3edd46834
Diffstat (limited to 'generic/regc_color.c')
-rw-r--r-- | generic/regc_color.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/generic/regc_color.c b/generic/regc_color.c index 003f5fc..ba1f668 100644 --- a/generic/regc_color.c +++ b/generic/regc_color.c @@ -611,12 +611,9 @@ okcolors( scd->sub = NOSUB; while ((a = cd->arcs) != NULL) { assert(a->co == co); - /* uncolorchain(cm, a); */ - cd->arcs = a->colorchain; + uncolorchain(cm, a); a->co = sco; - /* colorchain(cm, a); */ - a->colorchain = scd->arcs; - scd->arcs = a; + colorchain(cm, a); } freecolor(cm, co); } else { @@ -648,7 +645,11 @@ colorchain( { struct colordesc *cd = &cm->cd[a->co]; + if (cd->arcs != NULL) { + cd->arcs->colorchainRev = a; + } a->colorchain = cd->arcs; + a->colorchainRev = NULL; cd->arcs = a; } @@ -662,20 +663,20 @@ uncolorchain( struct arc *a) { struct colordesc *cd = &cm->cd[a->co]; - struct arc *aa; + struct arc *aa = a->colorchainRev; - aa = cd->arcs; - if (aa == a) { /* easy case */ + if (aa == NULL) { + assert(cd->arcs == a); cd->arcs = a->colorchain; } else { - assert(aa != NULL); - for (; aa->colorchain!=a ; aa=aa->colorchain) { - assert(aa->colorchain != NULL); - continue; - } + assert(aa->colorchain == a); aa->colorchain = a->colorchain; } + if (a->colorchain != NULL) { + a->colorchain->colorchainRev = aa; + } a->colorchain = NULL; /* paranoia */ + a->colorchainRev = NULL; } /* |