Fixed compilation warnings
authorMaximilian Szengel <gnunet@maxsz.de>
Mon, 7 May 2012 17:31:46 +0000 (17:31 +0000)
committerMaximilian Szengel <gnunet@maxsz.de>
Mon, 7 May 2012 17:31:46 +0000 (17:31 +0000)
src/regex/regex.c
src/regex/test_regex_iterate_api.c

index 814ae5597f5afc68e3baaf80f8062bdcdeeb7c3e..53303c042899914d5e0558424f5cd68df6e285da 100644 (file)
@@ -274,10 +274,17 @@ struct GNUNET_REGEX_StateSet
   unsigned int len;
 };
 
+/*
+ * Debug helper function
+ */
+/*
+static void debug_print_transition (struct Transition *);
+
 static void
 debug_print_state (struct GNUNET_REGEX_State *s)
 {
   char *proof;
+  int i;
 
   if (NULL == s->proof)
     proof = "NULL";
@@ -288,6 +295,11 @@ debug_print_state (struct GNUNET_REGEX_State *s)
               "State %i: %s marked: %i accepting: %i scc_id: %i transitions: %i proof: %s\n",
               s->id, s->name, s->marked, s->accepting, s->scc_id,
               s->transition_count, proof);
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Incoming transitions:\n");
+
+  for (i=0; i < s->incoming_transition_count; i++)
+    debug_print_transition (s->incoming_transitions[i]);
 }
 
 static void
@@ -340,6 +352,7 @@ debug_print_transitions (struct GNUNET_REGEX_State *s)
   for (t = s->transitions_head; NULL != t; t = t->next)
     debug_print_transition (t);
 }
+*/
 
 /**
  * Recursive function doing DFS with 'v' as a start, detecting all SCCs inside
@@ -1163,12 +1176,8 @@ dfa_merge_nondistinguishable_states (struct GNUNET_REGEX_Context *ctx,
             }
           }
         }
-        if (num_equal_edges == 0)
-        {
-          table[s1->marked][s2->marked] = -1;
-        }
-        else if (num_equal_edges != s1->transition_count ||
-                 num_equal_edges != s2->transition_count)
+        if (num_equal_edges != s1->transition_count ||
+            num_equal_edges != s2->transition_count)
         {
           // Make sure ALL edges of possible equal states are the same
           table[s1->marked][s2->marked] = -2;
@@ -1913,7 +1922,6 @@ GNUNET_REGEX_construct_dfa (const char *regex, const size_t len)
   // Create proofs for all states
   automaton_traverse (NULL, dfa, &state_create_proof);
 
-
   return dfa;
 }
 
index 7c7324aa5d66a3bdc3748e210894e91d1b2994ef..b214d6a931de9168927befbdbc897f372e5eab1d 100644 (file)
@@ -58,31 +58,14 @@ main (int argc, char *argv[])
   int error;
   const char *regex;
   struct GNUNET_REGEX_Automaton *dfa;
-  struct GNUNET_REGEX_Automaton *nfa;
 
   error = 0;
-  /*regex = "ab?|xy|(abcd)?"; */
-  /*regex = "(ab|cd|ef)xy"; */
-  /*regex = "(ac|bc)de"; */
-  /*regex = "((a|b)c)de"; */
-  /*regex = "a+X*y+c|p|R|Z*K*y*R+w|Y*6+n+h*k*w+V*F|W*B*e*"; */
   regex = "ab(c|d)+c*(a(b|c)d)+";
-  /*regex = "ab?(abcd)?"; */
-  const char *regex1 = "(ac|bc)de";
-  const char *regex2 = "((a|b)c)de";
 
-  /*nfa = GNUNET_REGEX_construct_nfa (regex, strlen (regex)); */
-  /*GNUNET_REGEX_automaton_save_graph (nfa, "nfa.dot"); */
   dfa = GNUNET_REGEX_construct_dfa (regex, strlen (regex));
   GNUNET_REGEX_automaton_save_graph (dfa, "dfa.dot");
   GNUNET_REGEX_iterate_all_edges (dfa, key_iterator, NULL);
   GNUNET_REGEX_automaton_destroy (dfa);
-  dfa = GNUNET_REGEX_construct_dfa (regex1, strlen (regex1));
-  GNUNET_REGEX_automaton_save_graph (dfa, "dfa1.dot");
-  GNUNET_REGEX_automaton_destroy (dfa);
-  dfa = GNUNET_REGEX_construct_dfa (regex2, strlen (regex2));
-  GNUNET_REGEX_automaton_save_graph (dfa, "dfa2.dot");
-  GNUNET_REGEX_automaton_destroy (dfa);
 
   return error;
 }