[apparmor] [PATCH 3/9] Renaming the match_count variable to duplicates

John Johansen john.johansen at canonical.com
Wed Nov 10 22:02:24 GMT 2010


The match_count variable is a sum of the number of duplicates node sets
that have been encountered and discarded.  Rename it to better reflect what
it is doing.

Signed-off-by: John Johansen <john.johansen at canonical.com>
---
 parser/libapparmor_re/regexp.y |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/parser/libapparmor_re/regexp.y b/parser/libapparmor_re/regexp.y
index f866b78..7cbe0bb 100644
--- a/parser/libapparmor_re/regexp.y
+++ b/parser/libapparmor_re/regexp.y
@@ -1467,7 +1467,7 @@ do { \
 			proto_max = (NODES)->size(); \
 	} else { \
 		/* set of nodes already has a mapping so free this one */ \
-		match_count++; \
+		duplicates++; \
 		delete (NODES);	    \
 		TARGET = x->second; \
 	} \
@@ -1490,8 +1490,8 @@ void DFA::dump_node_to_dfa(void)
  */
 DFA::DFA(Node *root, dfaflags_t flags) : root(root)
 {
-	int i, match_count;
-	i = match_count = 0;
+	int i, duplicates;
+	i = duplicates = 0;
 
 	if (flags & DFA_DUMP_PROGRESS)
 		fprintf(stderr, "Creating dfa:\r");
@@ -1539,7 +1539,7 @@ DFA::DFA(Node *root, dfaflags_t flags) : root(root)
 
 	while (!work_queue.empty()) {
 		if (i % 1000 == 0 && (flags & DFA_DUMP_PROGRESS))
-			fprintf(stderr, "\033[2KCreating dfa: queue %ld\tstates %ld\teliminated duplicates %d\r", work_queue.size(), states.size(), match_count);
+			fprintf(stderr, "\033[2KCreating dfa: queue %ld\tstates %ld\teliminated duplicates %d\r", work_queue.size(), states.size(), duplicates);
 		i++;
 
 		int error;
@@ -1610,7 +1610,7 @@ DFA::DFA(Node *root, dfaflags_t flags) : root(root)
 	nodemap.clear();
 
 	if (flags & (DFA_DUMP_STATS))
-	  fprintf(stderr, "\033[2KCreated dfa: states %ld,\teliminated duplicates %d,\tprotostate sets: longest %u, avg %u\n", states.size(), match_count, proto_max, (unsigned int) (proto_sum/states.size()));
+	  fprintf(stderr, "\033[2KCreated dfa: states %ld,\teliminated duplicates %d,\tprotostate sets: longest %u, avg %u\n", states.size(), duplicates, proto_max, (unsigned int) (proto_sum/states.size()));
 
 }
 
-- 
1.7.1




More information about the AppArmor mailing list