diff options
author | Maximilian Szengel <gnunet@maxsz.de> | 2012-05-07 17:31:46 +0000 |
---|---|---|
committer | Maximilian Szengel <gnunet@maxsz.de> | 2012-05-07 17:31:46 +0000 |
commit | 1f0049fedb1762160919ba1038624dd3595f42f1 (patch) | |
tree | bd1392afb156dd28be242e6ae42ed890b31c7320 /src | |
parent | db2a19f87735460deeb0716fcaed651875a74c6f (diff) | |
download | gnunet-1f0049fedb1762160919ba1038624dd3595f42f1.tar.gz gnunet-1f0049fedb1762160919ba1038624dd3595f42f1.zip |
Fixed compilation warnings
Diffstat (limited to 'src')
-rw-r--r-- | src/regex/regex.c | 22 | ||||
-rw-r--r-- | src/regex/test_regex_iterate_api.c | 17 |
2 files changed, 15 insertions, 24 deletions
diff --git a/src/regex/regex.c b/src/regex/regex.c index 814ae5597..53303c042 100644 --- a/src/regex/regex.c +++ b/src/regex/regex.c | |||
@@ -274,10 +274,17 @@ struct GNUNET_REGEX_StateSet | |||
274 | unsigned int len; | 274 | unsigned int len; |
275 | }; | 275 | }; |
276 | 276 | ||
277 | /* | ||
278 | * Debug helper function | ||
279 | */ | ||
280 | /* | ||
281 | static void debug_print_transition (struct Transition *); | ||
282 | |||
277 | static void | 283 | static void |
278 | debug_print_state (struct GNUNET_REGEX_State *s) | 284 | debug_print_state (struct GNUNET_REGEX_State *s) |
279 | { | 285 | { |
280 | char *proof; | 286 | char *proof; |
287 | int i; | ||
281 | 288 | ||
282 | if (NULL == s->proof) | 289 | if (NULL == s->proof) |
283 | proof = "NULL"; | 290 | proof = "NULL"; |
@@ -288,6 +295,11 @@ debug_print_state (struct GNUNET_REGEX_State *s) | |||
288 | "State %i: %s marked: %i accepting: %i scc_id: %i transitions: %i proof: %s\n", | 295 | "State %i: %s marked: %i accepting: %i scc_id: %i transitions: %i proof: %s\n", |
289 | s->id, s->name, s->marked, s->accepting, s->scc_id, | 296 | s->id, s->name, s->marked, s->accepting, s->scc_id, |
290 | s->transition_count, proof); | 297 | s->transition_count, proof); |
298 | |||
299 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Incoming transitions:\n"); | ||
300 | |||
301 | for (i=0; i < s->incoming_transition_count; i++) | ||
302 | debug_print_transition (s->incoming_transitions[i]); | ||
291 | } | 303 | } |
292 | 304 | ||
293 | static void | 305 | static void |
@@ -340,6 +352,7 @@ debug_print_transitions (struct GNUNET_REGEX_State *s) | |||
340 | for (t = s->transitions_head; NULL != t; t = t->next) | 352 | for (t = s->transitions_head; NULL != t; t = t->next) |
341 | debug_print_transition (t); | 353 | debug_print_transition (t); |
342 | } | 354 | } |
355 | */ | ||
343 | 356 | ||
344 | /** | 357 | /** |
345 | * Recursive function doing DFS with 'v' as a start, detecting all SCCs inside | 358 | * 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, | |||
1163 | } | 1176 | } |
1164 | } | 1177 | } |
1165 | } | 1178 | } |
1166 | if (num_equal_edges == 0) | 1179 | if (num_equal_edges != s1->transition_count || |
1167 | { | 1180 | num_equal_edges != s2->transition_count) |
1168 | table[s1->marked][s2->marked] = -1; | ||
1169 | } | ||
1170 | else if (num_equal_edges != s1->transition_count || | ||
1171 | num_equal_edges != s2->transition_count) | ||
1172 | { | 1181 | { |
1173 | // Make sure ALL edges of possible equal states are the same | 1182 | // Make sure ALL edges of possible equal states are the same |
1174 | table[s1->marked][s2->marked] = -2; | 1183 | table[s1->marked][s2->marked] = -2; |
@@ -1913,7 +1922,6 @@ GNUNET_REGEX_construct_dfa (const char *regex, const size_t len) | |||
1913 | // Create proofs for all states | 1922 | // Create proofs for all states |
1914 | automaton_traverse (NULL, dfa, &state_create_proof); | 1923 | automaton_traverse (NULL, dfa, &state_create_proof); |
1915 | 1924 | ||
1916 | |||
1917 | return dfa; | 1925 | return dfa; |
1918 | } | 1926 | } |
1919 | 1927 | ||
diff --git a/src/regex/test_regex_iterate_api.c b/src/regex/test_regex_iterate_api.c index 7c7324aa5..b214d6a93 100644 --- a/src/regex/test_regex_iterate_api.c +++ b/src/regex/test_regex_iterate_api.c | |||
@@ -58,31 +58,14 @@ main (int argc, char *argv[]) | |||
58 | int error; | 58 | int error; |
59 | const char *regex; | 59 | const char *regex; |
60 | struct GNUNET_REGEX_Automaton *dfa; | 60 | struct GNUNET_REGEX_Automaton *dfa; |
61 | struct GNUNET_REGEX_Automaton *nfa; | ||
62 | 61 | ||
63 | error = 0; | 62 | error = 0; |
64 | /*regex = "ab?|xy|(abcd)?"; */ | ||
65 | /*regex = "(ab|cd|ef)xy"; */ | ||
66 | /*regex = "(ac|bc)de"; */ | ||
67 | /*regex = "((a|b)c)de"; */ | ||
68 | /*regex = "a+X*y+c|p|R|Z*K*y*R+w|Y*6+n+h*k*w+V*F|W*B*e*"; */ | ||
69 | regex = "ab(c|d)+c*(a(b|c)d)+"; | 63 | regex = "ab(c|d)+c*(a(b|c)d)+"; |
70 | /*regex = "ab?(abcd)?"; */ | ||
71 | const char *regex1 = "(ac|bc)de"; | ||
72 | const char *regex2 = "((a|b)c)de"; | ||
73 | 64 | ||
74 | /*nfa = GNUNET_REGEX_construct_nfa (regex, strlen (regex)); */ | ||
75 | /*GNUNET_REGEX_automaton_save_graph (nfa, "nfa.dot"); */ | ||
76 | dfa = GNUNET_REGEX_construct_dfa (regex, strlen (regex)); | 65 | dfa = GNUNET_REGEX_construct_dfa (regex, strlen (regex)); |
77 | GNUNET_REGEX_automaton_save_graph (dfa, "dfa.dot"); | 66 | GNUNET_REGEX_automaton_save_graph (dfa, "dfa.dot"); |
78 | GNUNET_REGEX_iterate_all_edges (dfa, key_iterator, NULL); | 67 | GNUNET_REGEX_iterate_all_edges (dfa, key_iterator, NULL); |
79 | GNUNET_REGEX_automaton_destroy (dfa); | 68 | GNUNET_REGEX_automaton_destroy (dfa); |
80 | dfa = GNUNET_REGEX_construct_dfa (regex1, strlen (regex1)); | ||
81 | GNUNET_REGEX_automaton_save_graph (dfa, "dfa1.dot"); | ||
82 | GNUNET_REGEX_automaton_destroy (dfa); | ||
83 | dfa = GNUNET_REGEX_construct_dfa (regex2, strlen (regex2)); | ||
84 | GNUNET_REGEX_automaton_save_graph (dfa, "dfa2.dot"); | ||
85 | GNUNET_REGEX_automaton_destroy (dfa); | ||
86 | 69 | ||
87 | return error; | 70 | return error; |
88 | } | 71 | } |