diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-06-20 08:32:50 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-06-20 08:32:50 +0000 |
commit | 21a2b4f95b4488645ba5a6254fcb8919c4915f73 (patch) | |
tree | 00c92cb7103cc14fba7e63e8dee99fe711856863 /src/regex/test_regex_iterate_api.c | |
parent | 5533b105943b4f6dd688c1758350cd83ebeab3b9 (diff) | |
download | gnunet-21a2b4f95b4488645ba5a6254fcb8919c4915f73.tar.gz gnunet-21a2b4f95b4488645ba5a6254fcb8919c4915f73.zip |
continuing refactoring of regex library structure, disambiguating symbol names between old regex library which is now internal and the public API; moving IP-to-regex conversion functions to tun library, as only vpn is using those to begin with
Diffstat (limited to 'src/regex/test_regex_iterate_api.c')
-rw-r--r-- | src/regex/test_regex_iterate_api.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/regex/test_regex_iterate_api.c b/src/regex/test_regex_iterate_api.c index 695bc3075..dd6c09347 100644 --- a/src/regex/test_regex_iterate_api.c +++ b/src/regex/test_regex_iterate_api.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <regex.h> | 25 | #include <regex.h> |
26 | #include <time.h> | 26 | #include <time.h> |
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_regex_lib.h" | 28 | #include "regex_internal_lib.h" |
29 | #include "regex_internal.h" | 29 | #include "regex_internal.h" |
30 | 30 | ||
31 | /** | 31 | /** |
@@ -36,7 +36,7 @@ | |||
36 | /** | 36 | /** |
37 | * Set to GNUNET_YES to save a debug graph. | 37 | * Set to GNUNET_YES to save a debug graph. |
38 | */ | 38 | */ |
39 | #define GNUNET_REGEX_ITERATE_SAVE_DEBUG_GRAPH GNUNET_NO | 39 | #define REGEX_ITERNAL_ITERATE_SAVE_DEBUG_GRAPH GNUNET_NO |
40 | 40 | ||
41 | static unsigned int transition_counter; | 41 | static unsigned int transition_counter; |
42 | 42 | ||
@@ -61,7 +61,7 @@ struct RegexStringPair | |||
61 | static void | 61 | static void |
62 | key_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof, | 62 | key_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof, |
63 | int accepting, unsigned int num_edges, | 63 | int accepting, unsigned int num_edges, |
64 | const struct GNUNET_REGEX_Edge *edges) | 64 | const struct REGEX_ITERNAL_Edge *edges) |
65 | { | 65 | { |
66 | unsigned int i; | 66 | unsigned int i; |
67 | struct IteratorContext *ctx = cls; | 67 | struct IteratorContext *ctx = cls; |
@@ -101,7 +101,7 @@ key_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof, | |||
101 | ctx->match_count++; | 101 | ctx->match_count++; |
102 | } | 102 | } |
103 | 103 | ||
104 | if (GNUNET_OK != GNUNET_REGEX_check_proof (proof, key)) | 104 | if (GNUNET_OK != REGEX_ITERNAL_check_proof (proof, key)) |
105 | { | 105 | { |
106 | ctx->error++; | 106 | ctx->error++; |
107 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 107 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -117,7 +117,7 @@ main (int argc, char *argv[]) | |||
117 | GNUNET_log_setup ("test-regex", "WARNING", NULL); | 117 | GNUNET_log_setup ("test-regex", "WARNING", NULL); |
118 | 118 | ||
119 | int error; | 119 | int error; |
120 | struct GNUNET_REGEX_Automaton *dfa; | 120 | struct REGEX_ITERNAL_Automaton *dfa; |
121 | unsigned int i; | 121 | unsigned int i; |
122 | unsigned int num_transitions; | 122 | unsigned int num_transitions; |
123 | char *filename = NULL; | 123 | char *filename = NULL; |
@@ -161,7 +161,7 @@ main (int argc, char *argv[]) | |||
161 | 161 | ||
162 | 162 | ||
163 | /* Create graph */ | 163 | /* Create graph */ |
164 | if (GNUNET_YES == GNUNET_REGEX_ITERATE_SAVE_DEBUG_GRAPH) | 164 | if (GNUNET_YES == REGEX_ITERNAL_ITERATE_SAVE_DEBUG_GRAPH) |
165 | { | 165 | { |
166 | GNUNET_asprintf (&filename, "iteration_graph_%u.dot", i); | 166 | GNUNET_asprintf (&filename, "iteration_graph_%u.dot", i); |
167 | ctx.graph_filep = fopen (filename, "w"); | 167 | ctx.graph_filep = fopen (filename, "w"); |
@@ -191,10 +191,10 @@ main (int argc, char *argv[]) | |||
191 | ctx.strings = rxstr[i].strings; | 191 | ctx.strings = rxstr[i].strings; |
192 | ctx.match_count = 0; | 192 | ctx.match_count = 0; |
193 | dfa = | 193 | dfa = |
194 | GNUNET_REGEX_construct_dfa (rxstr[i].regex, strlen (rxstr[i].regex), 0); | 194 | REGEX_ITERNAL_construct_dfa (rxstr[i].regex, strlen (rxstr[i].regex), 0); |
195 | GNUNET_REGEX_iterate_all_edges (dfa, key_iterator, &ctx); | 195 | REGEX_ITERNAL_iterate_all_edges (dfa, key_iterator, &ctx); |
196 | num_transitions = | 196 | num_transitions = |
197 | GNUNET_REGEX_get_transition_count (dfa) - dfa->start->transition_count; | 197 | REGEX_ITERNAL_get_transition_count (dfa) - dfa->start->transition_count; |
198 | 198 | ||
199 | if (transition_counter < num_transitions) | 199 | if (transition_counter < num_transitions) |
200 | { | 200 | { |
@@ -218,7 +218,7 @@ main (int argc, char *argv[]) | |||
218 | error += (ctx.string_count - ctx.match_count); | 218 | error += (ctx.string_count - ctx.match_count); |
219 | } | 219 | } |
220 | 220 | ||
221 | GNUNET_REGEX_automaton_destroy (dfa); | 221 | REGEX_ITERNAL_automaton_destroy (dfa); |
222 | 222 | ||
223 | /* Finish graph */ | 223 | /* Finish graph */ |
224 | if (GNUNET_YES == ctx.should_save_graph) | 224 | if (GNUNET_YES == ctx.should_save_graph) |
@@ -238,9 +238,9 @@ main (int argc, char *argv[]) | |||
238 | ctx.match_count = 0; | 238 | ctx.match_count = 0; |
239 | 239 | ||
240 | dfa = | 240 | dfa = |
241 | GNUNET_REGEX_construct_dfa (rxstr[i].regex, strlen (rxstr[i].regex), 0); | 241 | REGEX_ITERNAL_construct_dfa (rxstr[i].regex, strlen (rxstr[i].regex), 0); |
242 | GNUNET_REGEX_dfa_add_multi_strides (NULL, dfa, 2); | 242 | REGEX_ITERNAL_dfa_add_multi_strides (NULL, dfa, 2); |
243 | GNUNET_REGEX_iterate_all_edges (dfa, key_iterator, &ctx); | 243 | REGEX_ITERNAL_iterate_all_edges (dfa, key_iterator, &ctx); |
244 | 244 | ||
245 | if (ctx.match_count < ctx.string_count) | 245 | if (ctx.match_count < ctx.string_count) |
246 | { | 246 | { |
@@ -249,7 +249,7 @@ main (int argc, char *argv[]) | |||
249 | error += (ctx.string_count - ctx.match_count); | 249 | error += (ctx.string_count - ctx.match_count); |
250 | } | 250 | } |
251 | 251 | ||
252 | GNUNET_REGEX_automaton_destroy (dfa); | 252 | REGEX_ITERNAL_automaton_destroy (dfa); |
253 | } | 253 | } |
254 | 254 | ||
255 | error += ctx.error; | 255 | error += ctx.error; |