fix
authorMaximilian Szengel <gnunet@maxsz.de>
Tue, 10 Apr 2012 14:37:53 +0000 (14:37 +0000)
committerMaximilian Szengel <gnunet@maxsz.de>
Tue, 10 Apr 2012 14:37:53 +0000 (14:37 +0000)
src/regex/regex.c
src/regex/test_regex.c

index 0ebce7a89ec948fcb4dc5cf080d11cffeb139437..6f5b20cc2fbd258a10a5e1ad0c0a07ad283a68f0 100644 (file)
@@ -403,7 +403,7 @@ automaton_merge_states (struct GNUNET_REGEX_Context *ctx,
     for (t_check = s_check->transitions_head; NULL != t_check;
          t_check = t_check->next)
     {
-      if (s_check != s2 && s2 == t_check->state)
+      if (s_check != s1 && s2 == t_check->state)
         t_check->state = s1;
     }
   }
@@ -1343,6 +1343,8 @@ GNUNET_REGEX_construct_dfa (const char *regex, const size_t len)
   dfa->start = dfa_state_create (&ctx, nfa_set);
   automaton_add_state (dfa, dfa->start);
   GNUNET_array_append (dfa_stack->states, dfa_stack->len, dfa->start);
+
+  // Create dfa states by combining nfa states
   while (dfa_stack->len > 0)
   {
     dfa_state = dfa_stack->states[dfa_stack->len - 1];
@@ -1385,7 +1387,7 @@ GNUNET_REGEX_construct_dfa (const char *regex, const size_t len)
   GNUNET_free (dfa_stack);
   GNUNET_REGEX_automaton_destroy (nfa);
 
-  /*dfa_minimize (&ctx, dfa);*/
+  dfa_minimize (&ctx, dfa);
 
   return dfa;
 }
index 373e5365fca5bfbeb6b44caf9103a50afb6b297e..3397864a3d96fbac2c84ef28b46a0842ed8821d3 100644 (file)
@@ -289,7 +289,7 @@ main (int argc, char *argv[])
 
   srand (time (NULL));
   for (i = 0; i < 100; i++)
-    check_rand += test_random (100, 150, 10);
+    check_rand += test_random (200, 250, 20);
 
   return check_nfa + check_dfa + check_rand;
 }