[apparmor] [patch 10/12] Refactor add_new_state into two version, one that splits anodes from nnodes, and one for use when anodes and nnodes are presplit

john.johansen at canonical.com john.johansen at canonical.com
Tue Aug 26 00:06:15 UTC 2014


Signed-off-by: John Johansen <john.johansen at canonical.com>
Acked-by: Steve Beattie <steve at nxnw.org>

=== modified file 'parser/libapparmor_re/hfa.cc'
---
 parser/libapparmor_re/hfa.cc |   20 ++++++++++++++------
 parser/libapparmor_re/hfa.h  |    1 +
 2 files changed, 15 insertions(+), 6 deletions(-)

--- parser/libapparmor_re/hfa.cc.orig
+++ parser/libapparmor_re/hfa.cc
@@ -278,14 +278,9 @@
 	*nnodes = nodes;
 }
 
-State *DFA::add_new_state(NodeSet *nodes, State *other)
+State *DFA::add_new_state(NodeSet *anodes, NodeSet *nnodes, State *other)
 {
-	/* The splitting of nodes should probably get pushed down into
-	 * follow(), ie. put in separate lists from the start
-	 */
-	NodeSet *anodes, *nnodes;
 	hashedNodeVec *nnodev;
-	split_node_types(nodes, &anodes, &nnodes);
 	nnodev = nnodes_cache.insert(nnodes);
 	anodes = anodes_cache.insert(anodes);
 
@@ -303,6 +298,19 @@
 	return x.first->second;
 }
 
+State *DFA::add_new_state(NodeSet *nodes, State *other)
+{
+	/* The splitting of nodes should probably get pushed down into
+	 * follow(), ie. put in separate lists from the start
+	 */
+	NodeSet *anodes, *nnodes;
+	split_node_types(nodes, &anodes, &nnodes);
+
+	State *state = add_new_state(anodes, nnodes, other);
+
+	return state;
+}
+
 void DFA::update_state_transitions(State *state)
 {
 	/* Compute possible transitions for state->nodes.  This is done by
--- parser/libapparmor_re/hfa.h.orig
+++ parser/libapparmor_re/hfa.h
@@ -291,6 +291,7 @@
 class DFA {
 	void dump_node_to_dfa(void);
 	State *add_new_state(NodeSet *nodes, State *other);
+	State *add_new_state(NodeSet *anodes, NodeSet *nnodes, State *other);
 	void update_state_transitions(State *state);
 	void process_work_queue(const char *header, dfaflags_t);
 	void dump_diff_chain(ostream &os, map<State *, Partition> &relmap,




More information about the AppArmor mailing list