From 836020bfb15bd865fffacaf39a6183da285999f5 Mon Sep 17 00:00:00 2001 From: Maximilian Szengel Date: Tue, 10 Apr 2012 14:37:53 +0000 Subject: [PATCH] fix --- src/regex/regex.c | 6 ++++-- src/regex/test_regex.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/regex/regex.c b/src/regex/regex.c index 0ebce7a89..6f5b20cc2 100644 --- a/src/regex/regex.c +++ b/src/regex/regex.c @@ -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; } diff --git a/src/regex/test_regex.c b/src/regex/test_regex.c index 373e5365f..3397864a3 100644 --- a/src/regex/test_regex.c +++ b/src/regex/test_regex.c @@ -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; } -- 2.25.1