[augeas-devel] [PATCH 2 of 6] Do not minimize freshly created regexps

David Lutterkort dlutter at redhat.com
Tue May 6 01:12:21 UTC 2008


# HG changeset patch
# User David Lutterkort <dlutter at redhat.com>
# Date 1210036168 25200
# Node ID 3f3b57d37d78c8bb0f99483b2cec991533fad761
# Parent  65fb6042de243d0274bc776ab1e43881f044f3fb
Do not minimize freshly created regexps

The minimization imposes a serious performance penalty, and is generally
not needed.

This also exposes a bug in fa_overlap; for acceptToAccept to work properly,
it needs to be passed a deterministic automaton.

diff -r 65fb6042de24 -r 3f3b57d37d78 src/fa.c
--- a/src/fa.c	Mon May 05 18:09:22 2008 -0700
+++ b/src/fa.c	Mon May 05 18:09:28 2008 -0700
@@ -1936,6 +1936,7 @@ struct fa *fa_overlap(struct fa *fa1, st
     fa1 = fa_clone(fa1);
     fa2 = fa_clone(fa2);
 
+    determinize(fa1, NULL);
     accept_to_accept(fa1);
 
     map = fa_reverse(fa2);
@@ -2242,9 +2243,7 @@ int fa_compile(const char *regexp, struc
     *fa = fa_from_re(re);
     re_free(re);
 
-    // FIXME: it should be enough to clean up here, but that makes
-    // various tests fail
-    fa_minimize(*fa);
+    collect(*fa);
     return ret;
 }
 




More information about the augeas-devel mailing list