diff options
author | szengel <szengel@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-09-13 09:25:55 +0000 |
---|---|---|
committer | szengel <szengel@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-09-13 09:25:55 +0000 |
commit | 8fc220b62e7c0ad1e4d73137a4a8079198a711af (patch) | |
tree | 853739276d24023ad4adf92d2569a54919967ebb /src/regex/regex.c | |
parent | f8ee34e262954ab1f88a98049cc912cc9d50265c (diff) |
comments
git-svn-id: https://gnunet.org/svn/gnunet@23762 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/regex/regex.c')
-rw-r--r-- | src/regex/regex.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/regex/regex.c b/src/regex/regex.c index 68313664da..4c0f288510 100644 --- a/src/regex/regex.c +++ b/src/regex/regex.c @@ -644,7 +644,7 @@ GNUNET_REGEX_add_multi_strides_to_dfa (struct GNUNET_REGEX_Context *regex_ctx, struct GNUNET_REGEX_Transition *t; struct GNUNET_REGEX_Transition *t_next; - if (1 > stride_len) + if (1 > stride_len || GNUNET_YES == dfa->is_multistrided) return; // Compute the new transitions. @@ -660,6 +660,8 @@ GNUNET_REGEX_add_multi_strides_to_dfa (struct GNUNET_REGEX_Context *regex_ctx, GNUNET_free_non_null (t->label); GNUNET_free (t); } + + dfa->is_multistrided = GNUNET_YES; } @@ -1383,7 +1385,7 @@ dfa_state_create (struct GNUNET_REGEX_Context *ctx, if (nfa_states->len < 1) return s; - // Create a name based on 'sset' + // Create a name based on 'nfa_states' s->name = GNUNET_malloc (sizeof (char) * 2); strcat (s->name, "{"); name = NULL; @@ -2255,11 +2257,15 @@ GNUNET_REGEX_construct_nfa (const char *regex, const size_t len) goto error; } + /* Remember the regex that was used to generate this NFA */ nfa->regex = GNUNET_strdup (regex); /* create depth-first numbering of the states for pretty printing */ GNUNET_REGEX_automaton_traverse (nfa, NULL, NULL, NULL, &number_states, NULL); + /* No multistriding added so far */ + nfa->is_multistrided = GNUNET_NO; + return nfa; error: @@ -2367,6 +2373,7 @@ GNUNET_REGEX_construct_dfa (const char *regex, const size_t len) dfa->states_head = NULL; dfa->states_tail = NULL; dfa->regex = GNUNET_strdup (regex); + dfa->is_multistrided = GNUNET_NO; // Create DFA start state from epsilon closure nfa_start_eps_cls = nfa_closure_create (nfa, nfa->start, 0); |