[apparmor] [PATCH 11/11] Move dfa minimization and remove unreachable outside of dfa creation

John Johansen john.johansen at canonical.com
Tue Oct 19 01:20:43 BST 2010


As from a library pov they should be seperately callable fns, and this will
help reduce peak memory usage in some cases.

Also disbale remove_unreachable, as the current dfa code isn't generating
unreachable states, and minimization removes any states that are connected
but redundant.
---
 parser/libapparmor_re/regexp.y |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/parser/libapparmor_re/regexp.y b/parser/libapparmor_re/regexp.y
index 5978613..5fb356b 100644
--- a/parser/libapparmor_re/regexp.y
+++ b/parser/libapparmor_re/regexp.y
@@ -1546,12 +1546,6 @@ DFA::DFA(Node *root, dfaflags_t flags) : root(root)
 
 	/* TODO Dump dfa with NODE mapping - or node to dfa mapping */
 	// ??????
-
-	if (flags & DFA_CONTROL_MINIMIZE)
-		minimize(flags);
-
-	if (flags & DFA_CONTROL_REMOVE_UNREACHABLE)
-		remove_unreachable(flags);
 }
 
 
@@ -2915,6 +2909,12 @@ extern "C" void *aare_create_dfa(aare_ruleset_t *rules, size_t *size, dfaflags_t
 
     DFA dfa(rules->root, flags);
 
+    if (flags & DFA_CONTROL_MINIMIZE)
+        minimize(flags);
+
+    //if (flags & DFA_CONTROL_REMOVE_UNREACHABLE)
+    //    remove_unreachable(flags);
+
     if (flags & DFA_DUMP_STATES)
 	dfa.dump(cerr);
 
-- 
1.7.1




More information about the AppArmor mailing list