diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/regex/Makefile.am | 2 | ||||
-rw-r--r-- | src/regex/gnunet-daemon-regexprofiler.c | 14 | ||||
-rw-r--r-- | src/regex/gnunet-regex-profiler.c | 8 | ||||
-rw-r--r-- | src/regex/gnunet-regex-simulation-profiler.c | 10 | ||||
-rw-r--r-- | src/regex/gnunet-service-regex.c | 14 | ||||
-rw-r--r-- | src/regex/perf-regex.c | 18 | ||||
-rw-r--r-- | src/regex/plugin_block_regex.c | 4 | ||||
-rw-r--r-- | src/regex/regex_block_lib.c | 8 | ||||
-rw-r--r-- | src/regex/regex_block_lib.h | 8 | ||||
-rw-r--r-- | src/regex/regex_internal.c | 454 | ||||
-rw-r--r-- | src/regex/regex_internal.h | 96 | ||||
-rw-r--r-- | src/regex/regex_internal_dht.c | 66 | ||||
-rw-r--r-- | src/regex/regex_internal_lib.h | 68 | ||||
-rw-r--r-- | src/regex/regex_test_graph.c | 42 | ||||
-rw-r--r-- | src/regex/regex_test_lib.c | 10 | ||||
-rw-r--r-- | src/regex/regex_test_lib.h | 32 | ||||
-rw-r--r-- | src/regex/regex_test_random.c | 4 | ||||
-rw-r--r-- | src/regex/test_regex_eval_api.c | 42 | ||||
-rw-r--r-- | src/regex/test_regex_graph_api.c | 72 | ||||
-rw-r--r-- | src/regex/test_regex_iterate_api.c | 26 | ||||
-rw-r--r-- | src/regex/test_regex_proofs.c | 32 |
21 files changed, 514 insertions, 516 deletions
diff --git a/src/regex/Makefile.am b/src/regex/Makefile.am index 34ef90ca0..e1c41d91e 100644 --- a/src/regex/Makefile.am +++ b/src/regex/Makefile.am | |||
@@ -31,8 +31,6 @@ gnunet_service_regex_LDADD = -lm \ | |||
31 | $(GN_LIBINTL) | 31 | $(GN_LIBINTL) |
32 | gnunet_service_regex_DEPENDENCIES = \ | 32 | gnunet_service_regex_DEPENDENCIES = \ |
33 | libgnunetregex_internal.a | 33 | libgnunetregex_internal.a |
34 | # todo: link files from libgnunetregex statically into gnunet_service_regex, | ||
35 | # rename API prefix to avoid collision with 'libgnunetregexnew'... | ||
36 | 34 | ||
37 | noinst_LIBRARIES = \ | 35 | noinst_LIBRARIES = \ |
38 | libgnunetregex_internal.a \ | 36 | libgnunetregex_internal.a \ |
diff --git a/src/regex/gnunet-daemon-regexprofiler.c b/src/regex/gnunet-daemon-regexprofiler.c index 6a61aa6f0..3f4dd087f 100644 --- a/src/regex/gnunet-daemon-regexprofiler.c +++ b/src/regex/gnunet-daemon-regexprofiler.c | |||
@@ -57,7 +57,7 @@ static struct GNUNET_DHT_Handle *dht_handle; | |||
57 | /** | 57 | /** |
58 | * Peer's regex announce handle. | 58 | * Peer's regex announce handle. |
59 | */ | 59 | */ |
60 | static struct REGEX_ITERNAL_Announcement *announce_handle; | 60 | static struct REGEX_INTERNAL_Announcement *announce_handle; |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Periodically reannounce regex. | 63 | * Periodically reannounce regex. |
@@ -109,7 +109,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
109 | 109 | ||
110 | if (NULL != announce_handle) | 110 | if (NULL != announce_handle) |
111 | { | 111 | { |
112 | REGEX_ITERNAL_announce_cancel (announce_handle); | 112 | REGEX_INTERNAL_announce_cancel (announce_handle); |
113 | announce_handle = NULL; | 113 | announce_handle = NULL; |
114 | } | 114 | } |
115 | 115 | ||
@@ -160,7 +160,7 @@ reannounce_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
160 | "First time, creating regex: %s\n", | 160 | "First time, creating regex: %s\n", |
161 | regex); | 161 | regex); |
162 | memset (&id, 0, sizeof (struct GNUNET_PeerIdentity)); | 162 | memset (&id, 0, sizeof (struct GNUNET_PeerIdentity)); |
163 | announce_handle = REGEX_ITERNAL_announce (dht_handle, | 163 | announce_handle = REGEX_INTERNAL_announce (dht_handle, |
164 | &id, | 164 | &id, |
165 | regex, | 165 | regex, |
166 | (unsigned int) max_path_compression, | 166 | (unsigned int) max_path_compression, |
@@ -169,7 +169,7 @@ reannounce_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
169 | else | 169 | else |
170 | { | 170 | { |
171 | GNUNET_assert (NULL != announce_handle); | 171 | GNUNET_assert (NULL != announce_handle); |
172 | REGEX_ITERNAL_reannounce (announce_handle); | 172 | REGEX_INTERNAL_reannounce (announce_handle); |
173 | } | 173 | } |
174 | 174 | ||
175 | random_delay = | 175 | random_delay = |
@@ -330,7 +330,7 @@ run (void *cls, char *const *args GNUNET_UNUSED, | |||
330 | /* Read regexes from policy files */ | 330 | /* Read regexes from policy files */ |
331 | GNUNET_assert (-1 != GNUNET_DISK_directory_scan (policy_dir, &scan, | 331 | GNUNET_assert (-1 != GNUNET_DISK_directory_scan (policy_dir, &scan, |
332 | (void *) (long) peer_id)); | 332 | (void *) (long) peer_id)); |
333 | if (NULL == (components = REGEX_ITERNAL_read_from_file (policy_filename))) | 333 | if (NULL == (components = REGEX_TEST_read_from_file (policy_filename))) |
334 | { | 334 | { |
335 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 335 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
336 | "Policy file %s contains no policies. Exiting.\n", | 336 | "Policy file %s contains no policies. Exiting.\n", |
@@ -339,8 +339,8 @@ run (void *cls, char *const *args GNUNET_UNUSED, | |||
339 | GNUNET_SCHEDULER_shutdown (); | 339 | GNUNET_SCHEDULER_shutdown (); |
340 | return; | 340 | return; |
341 | } | 341 | } |
342 | regex = REGEX_ITERNAL_combine (components); | 342 | regex = REGEX_TEST_combine (components); |
343 | REGEX_ITERNAL_free_from_file (components); | 343 | REGEX_TEST_free_from_file (components); |
344 | 344 | ||
345 | /* Announcing regexes from policy_filename */ | 345 | /* Announcing regexes from policy_filename */ |
346 | GNUNET_asprintf (&rx_with_pfx, "%s(%s)(0|1)*", regex_prefix, regex); | 346 | GNUNET_asprintf (&rx_with_pfx, "%s(%s)(0|1)*", regex_prefix, regex); |
diff --git a/src/regex/gnunet-regex-profiler.c b/src/regex/gnunet-regex-profiler.c index e6f35a6f4..cb257df49 100644 --- a/src/regex/gnunet-regex-profiler.c +++ b/src/regex/gnunet-regex-profiler.c | |||
@@ -150,7 +150,7 @@ struct RegexPeer | |||
150 | /** | 150 | /** |
151 | * Handle to a running regex search. | 151 | * Handle to a running regex search. |
152 | */ | 152 | */ |
153 | struct REGEX_ITERNAL_Search *search_handle; | 153 | struct REGEX_INTERNAL_Search *search_handle; |
154 | 154 | ||
155 | /** | 155 | /** |
156 | * Testbed operation handle for DHT. | 156 | * Testbed operation handle for DHT. |
@@ -702,7 +702,7 @@ find_string (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | |||
702 | * Method called when we've found a peer that announced a regex | 702 | * Method called when we've found a peer that announced a regex |
703 | * that matches our search string. Now get the statistics. | 703 | * that matches our search string. Now get the statistics. |
704 | * | 704 | * |
705 | * @param cls Closure provided in REGEX_ITERNAL_search. | 705 | * @param cls Closure provided in REGEX_INTERNAL_search. |
706 | * @param id Peer providing a regex that matches the string. | 706 | * @param id Peer providing a regex that matches the string. |
707 | * @param get_path Path of the get request. | 707 | * @param get_path Path of the get request. |
708 | * @param get_path_length Lenght of get_path. | 708 | * @param get_path_length Lenght of get_path. |
@@ -1039,7 +1039,7 @@ dht_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, | |||
1039 | GNUNET_assert (peer->dht_handle == ca_result); | 1039 | GNUNET_assert (peer->dht_handle == ca_result); |
1040 | 1040 | ||
1041 | peer->search_str_matched = GNUNET_NO; | 1041 | peer->search_str_matched = GNUNET_NO; |
1042 | peer->search_handle = REGEX_ITERNAL_search (peer->dht_handle, | 1042 | peer->search_handle = REGEX_INTERNAL_search (peer->dht_handle, |
1043 | peer->search_str, | 1043 | peer->search_str, |
1044 | ®ex_found_handler, peer, | 1044 | ®ex_found_handler, peer, |
1045 | NULL); | 1045 | NULL); |
@@ -1081,7 +1081,7 @@ dht_da (void *cls, void *op_result) | |||
1081 | 1081 | ||
1082 | if (NULL != peer->search_handle) | 1082 | if (NULL != peer->search_handle) |
1083 | { | 1083 | { |
1084 | REGEX_ITERNAL_search_cancel (peer->search_handle); | 1084 | REGEX_INTERNAL_search_cancel (peer->search_handle); |
1085 | peer->search_handle = NULL; | 1085 | peer->search_handle = NULL; |
1086 | } | 1086 | } |
1087 | 1087 | ||
diff --git a/src/regex/gnunet-regex-simulation-profiler.c b/src/regex/gnunet-regex-simulation-profiler.c index b3d1ff873..dcb6c02f6 100644 --- a/src/regex/gnunet-regex-simulation-profiler.c +++ b/src/regex/gnunet-regex-simulation-profiler.c | |||
@@ -335,7 +335,7 @@ return_ok (void *cls, unsigned int num_values, MYSQL_BIND * values) | |||
335 | static void | 335 | static void |
336 | regex_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof, | 336 | regex_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof, |
337 | int accepting, unsigned int num_edges, | 337 | int accepting, unsigned int num_edges, |
338 | const struct REGEX_ITERNAL_Edge *edges) | 338 | const struct REGEX_INTERNAL_Edge *edges) |
339 | { | 339 | { |
340 | unsigned int i; | 340 | unsigned int i; |
341 | int result; | 341 | int result; |
@@ -460,10 +460,10 @@ regex_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof, | |||
460 | static int | 460 | static int |
461 | announce_regex (const char *regex) | 461 | announce_regex (const char *regex) |
462 | { | 462 | { |
463 | struct REGEX_ITERNAL_Automaton *dfa; | 463 | struct REGEX_INTERNAL_Automaton *dfa; |
464 | 464 | ||
465 | dfa = | 465 | dfa = |
466 | REGEX_ITERNAL_construct_dfa (regex, strlen (regex), max_path_compression); | 466 | REGEX_INTERNAL_construct_dfa (regex, strlen (regex), max_path_compression); |
467 | 467 | ||
468 | if (NULL == dfa) | 468 | if (NULL == dfa) |
469 | { | 469 | { |
@@ -473,9 +473,9 @@ announce_regex (const char *regex) | |||
473 | return GNUNET_SYSERR; | 473 | return GNUNET_SYSERR; |
474 | } | 474 | } |
475 | 475 | ||
476 | REGEX_ITERNAL_iterate_all_edges (dfa, ®ex_iterator, NULL); | 476 | REGEX_INTERNAL_iterate_all_edges (dfa, ®ex_iterator, NULL); |
477 | 477 | ||
478 | REGEX_ITERNAL_automaton_destroy (dfa); | 478 | REGEX_INTERNAL_automaton_destroy (dfa); |
479 | 479 | ||
480 | return GNUNET_OK; | 480 | return GNUNET_OK; |
481 | } | 481 | } |
diff --git a/src/regex/gnunet-service-regex.c b/src/regex/gnunet-service-regex.c index f0a39a361..697b04a36 100644 --- a/src/regex/gnunet-service-regex.c +++ b/src/regex/gnunet-service-regex.c | |||
@@ -54,12 +54,12 @@ struct ClientEntry | |||
54 | /** | 54 | /** |
55 | * Search handle (if this client is searching). | 55 | * Search handle (if this client is searching). |
56 | */ | 56 | */ |
57 | struct REGEX_ITERNAL_Search *sh; | 57 | struct REGEX_INTERNAL_Search *sh; |
58 | 58 | ||
59 | /** | 59 | /** |
60 | * Announcement handle (if this client is announcing). | 60 | * Announcement handle (if this client is announcing). |
61 | */ | 61 | */ |
62 | struct REGEX_ITERNAL_Announcement *ah; | 62 | struct REGEX_INTERNAL_Announcement *ah; |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Refresh frequency for announcements. | 65 | * Refresh frequency for announcements. |
@@ -143,12 +143,12 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) | |||
143 | } | 143 | } |
144 | if (NULL != ce->ah) | 144 | if (NULL != ce->ah) |
145 | { | 145 | { |
146 | REGEX_ITERNAL_announce_cancel (ce->ah); | 146 | REGEX_INTERNAL_announce_cancel (ce->ah); |
147 | ce->ah = NULL; | 147 | ce->ah = NULL; |
148 | } | 148 | } |
149 | if (NULL != ce->sh) | 149 | if (NULL != ce->sh) |
150 | { | 150 | { |
151 | REGEX_ITERNAL_search_cancel (ce->sh); | 151 | REGEX_INTERNAL_search_cancel (ce->sh); |
152 | ce->sh = NULL; | 152 | ce->sh = NULL; |
153 | } | 153 | } |
154 | GNUNET_CONTAINER_DLL_remove (client_head, client_tail, ce); | 154 | GNUNET_CONTAINER_DLL_remove (client_head, client_tail, ce); |
@@ -171,7 +171,7 @@ reannounce (void *cls, | |||
171 | { | 171 | { |
172 | struct ClientEntry *ce = cls; | 172 | struct ClientEntry *ce = cls; |
173 | 173 | ||
174 | REGEX_ITERNAL_reannounce (ce->ah); | 174 | REGEX_INTERNAL_reannounce (ce->ah); |
175 | ce->refresh_task = GNUNET_SCHEDULER_add_delayed (ce->frequency, | 175 | ce->refresh_task = GNUNET_SCHEDULER_add_delayed (ce->frequency, |
176 | &reannounce, | 176 | &reannounce, |
177 | ce); | 177 | ce); |
@@ -207,7 +207,7 @@ handle_announce (void *cls, | |||
207 | } | 207 | } |
208 | ce = GNUNET_new (struct ClientEntry); | 208 | ce = GNUNET_new (struct ClientEntry); |
209 | ce->client = client; | 209 | ce->client = client; |
210 | ce->ah = REGEX_ITERNAL_announce (dht, | 210 | ce->ah = REGEX_INTERNAL_announce (dht, |
211 | &am->pid, | 211 | &am->pid, |
212 | regex, | 212 | regex, |
213 | ntohs (am->compression), | 213 | ntohs (am->compression), |
@@ -311,7 +311,7 @@ handle_search (void *cls, | |||
311 | } | 311 | } |
312 | ce = GNUNET_new (struct ClientEntry); | 312 | ce = GNUNET_new (struct ClientEntry); |
313 | ce->client = client; | 313 | ce->client = client; |
314 | ce->sh = REGEX_ITERNAL_search (dht, | 314 | ce->sh = REGEX_INTERNAL_search (dht, |
315 | string, | 315 | string, |
316 | &handle_search_result, | 316 | &handle_search_result, |
317 | ce, | 317 | ce, |
diff --git a/src/regex/perf-regex.c b/src/regex/perf-regex.c index 210b16b81..bc723b6cb 100644 --- a/src/regex/perf-regex.c +++ b/src/regex/perf-regex.c | |||
@@ -53,7 +53,7 @@ iter (void *cls, | |||
53 | const char *proof, | 53 | const char *proof, |
54 | int accepting, | 54 | int accepting, |
55 | unsigned int num_edges, | 55 | unsigned int num_edges, |
56 | const struct REGEX_ITERNAL_Edge *edges) | 56 | const struct REGEX_INTERNAL_Edge *edges) |
57 | { | 57 | { |
58 | unsigned int i; | 58 | unsigned int i; |
59 | 59 | ||
@@ -66,9 +66,9 @@ iter (void *cls, | |||
66 | } | 66 | } |
67 | 67 | ||
68 | static void | 68 | static void |
69 | print_dfa (struct REGEX_ITERNAL_Automaton* dfa) | 69 | print_dfa (struct REGEX_INTERNAL_Automaton* dfa) |
70 | { | 70 | { |
71 | REGEX_ITERNAL_iterate_all_edges (dfa, iter, NULL); | 71 | REGEX_INTERNAL_iterate_all_edges (dfa, iter, NULL); |
72 | } | 72 | } |
73 | 73 | ||
74 | /** | 74 | /** |
@@ -84,7 +84,7 @@ print_dfa (struct REGEX_ITERNAL_Automaton* dfa) | |||
84 | int | 84 | int |
85 | main (int argc, char *const *argv) | 85 | main (int argc, char *const *argv) |
86 | { | 86 | { |
87 | struct REGEX_ITERNAL_Automaton* dfa; | 87 | struct REGEX_INTERNAL_Automaton* dfa; |
88 | char **regexes; | 88 | char **regexes; |
89 | char *buffer; | 89 | char *buffer; |
90 | char *regex; | 90 | char *regex; |
@@ -98,14 +98,14 @@ main (int argc, char *const *argv) | |||
98 | usage(); | 98 | usage(); |
99 | return 1; | 99 | return 1; |
100 | } | 100 | } |
101 | regexes = REGEX_ITERNAL_read_from_file (argv[1]); | 101 | regexes = REGEX_TEST_read_from_file (argv[1]); |
102 | 102 | ||
103 | if (NULL == regexes) | 103 | if (NULL == regexes) |
104 | { | 104 | { |
105 | usage(); | 105 | usage(); |
106 | return 2; | 106 | return 2; |
107 | } | 107 | } |
108 | buffer = REGEX_ITERNAL_combine (regexes); | 108 | buffer = REGEX_TEST_combine (regexes); |
109 | 109 | ||
110 | GNUNET_asprintf (®ex, "GNVPN-0001-PAD(%s)(0|1)*", buffer); | 110 | GNUNET_asprintf (®ex, "GNVPN-0001-PAD(%s)(0|1)*", buffer); |
111 | size = strlen (regex); | 111 | size = strlen (regex); |
@@ -114,11 +114,11 @@ main (int argc, char *const *argv) | |||
114 | // return 0; | 114 | // return 0; |
115 | 115 | ||
116 | compression = atoi (argv[2]); | 116 | compression = atoi (argv[2]); |
117 | dfa = REGEX_ITERNAL_construct_dfa (regex, size, compression); | 117 | dfa = REGEX_INTERNAL_construct_dfa (regex, size, compression); |
118 | print_dfa (dfa); | 118 | print_dfa (dfa); |
119 | REGEX_ITERNAL_automaton_destroy (dfa); | 119 | REGEX_INTERNAL_automaton_destroy (dfa); |
120 | GNUNET_free (buffer); | 120 | GNUNET_free (buffer); |
121 | REGEX_ITERNAL_free_from_file (regexes); | 121 | REGEX_TEST_free_from_file (regexes); |
122 | GNUNET_free (regex); | 122 | GNUNET_free (regex); |
123 | return 0; | 123 | return 0; |
124 | } | 124 | } |
diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c index 43e59ea8c..82341813e 100644 --- a/src/regex/plugin_block_regex.c +++ b/src/regex/plugin_block_regex.c | |||
@@ -107,10 +107,10 @@ evaluate_block_regex (void *cls, enum GNUNET_BLOCK_Type type, | |||
107 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Block with no xquery\n"); | 107 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Block with no xquery\n"); |
108 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " key: %s, %u edges\n", | 108 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " key: %s, %u edges\n", |
109 | GNUNET_h2s (&rblock->key), ntohl (rblock->n_edges)); | 109 | GNUNET_h2s (&rblock->key), ntohl (rblock->n_edges)); |
110 | REGEX_ITERNAL_block_iterate (rblock, reply_block_size, &rdebug, NULL); | 110 | REGEX_INTERNAL_block_iterate (rblock, reply_block_size, &rdebug, NULL); |
111 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 111 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
112 | } | 112 | } |
113 | switch (REGEX_ITERNAL_block_check (reply_block, | 113 | switch (REGEX_INTERNAL_block_check (reply_block, |
114 | reply_block_size, | 114 | reply_block_size, |
115 | xquery)) | 115 | xquery)) |
116 | { | 116 | { |
diff --git a/src/regex/regex_block_lib.c b/src/regex/regex_block_lib.c index 383cf5626..63b673fbe 100644 --- a/src/regex/regex_block_lib.c +++ b/src/regex/regex_block_lib.c | |||
@@ -92,7 +92,7 @@ check_edge (void *cls, | |||
92 | 92 | ||
93 | 93 | ||
94 | int | 94 | int |
95 | REGEX_ITERNAL_block_check (const struct RegexBlock *block, | 95 | REGEX_INTERNAL_block_check (const struct RegexBlock *block, |
96 | size_t size, | 96 | size_t size, |
97 | const char *xquery) | 97 | const char *xquery) |
98 | { | 98 | { |
@@ -109,7 +109,7 @@ REGEX_ITERNAL_block_check (const struct RegexBlock *block, | |||
109 | ctx.xquery = xquery; | 109 | ctx.xquery = xquery; |
110 | ctx.found = GNUNET_NO; | 110 | ctx.found = GNUNET_NO; |
111 | ctx.key = GNUNET_strdup (GNUNET_h2s (&block->key)); | 111 | ctx.key = GNUNET_strdup (GNUNET_h2s (&block->key)); |
112 | res = REGEX_ITERNAL_block_iterate (block, size, &check_edge, &ctx); | 112 | res = REGEX_INTERNAL_block_iterate (block, size, &check_edge, &ctx); |
113 | GNUNET_free (ctx.key); | 113 | GNUNET_free (ctx.key); |
114 | if (GNUNET_SYSERR == res) | 114 | if (GNUNET_SYSERR == res) |
115 | return GNUNET_SYSERR; | 115 | return GNUNET_SYSERR; |
@@ -120,9 +120,9 @@ REGEX_ITERNAL_block_check (const struct RegexBlock *block, | |||
120 | 120 | ||
121 | 121 | ||
122 | int | 122 | int |
123 | REGEX_ITERNAL_block_iterate (const struct RegexBlock *block, | 123 | REGEX_INTERNAL_block_iterate (const struct RegexBlock *block, |
124 | size_t size, | 124 | size_t size, |
125 | REGEX_ITERNAL_EgdeIterator iterator, | 125 | REGEX_INTERNAL_EgdeIterator iterator, |
126 | void *iter_cls) | 126 | void *iter_cls) |
127 | { | 127 | { |
128 | struct RegexEdge *edge; | 128 | struct RegexEdge *edge; |
diff --git a/src/regex/regex_block_lib.h b/src/regex/regex_block_lib.h index 2ef7ef30c..a6c539229 100644 --- a/src/regex/regex_block_lib.h +++ b/src/regex/regex_block_lib.h | |||
@@ -52,7 +52,7 @@ extern "C" | |||
52 | * GNUNET_SYSERR if the block is invalid. | 52 | * GNUNET_SYSERR if the block is invalid. |
53 | */ | 53 | */ |
54 | int | 54 | int |
55 | REGEX_ITERNAL_block_check (const struct RegexBlock *block, | 55 | REGEX_INTERNAL_block_check (const struct RegexBlock *block, |
56 | size_t size, | 56 | size_t size, |
57 | const char *xquery); | 57 | const char *xquery); |
58 | 58 | ||
@@ -66,7 +66,7 @@ REGEX_ITERNAL_block_check (const struct RegexBlock *block, | |||
66 | * | 66 | * |
67 | * @return GNUNET_YES if should keep iterating, GNUNET_NO otherwise. | 67 | * @return GNUNET_YES if should keep iterating, GNUNET_NO otherwise. |
68 | */ | 68 | */ |
69 | typedef int (*REGEX_ITERNAL_EgdeIterator)(void *cls, | 69 | typedef int (*REGEX_INTERNAL_EgdeIterator)(void *cls, |
70 | const char *token, | 70 | const char *token, |
71 | size_t len, | 71 | size_t len, |
72 | const struct GNUNET_HashCode *key); | 72 | const struct GNUNET_HashCode *key); |
@@ -89,9 +89,9 @@ typedef int (*REGEX_ITERNAL_EgdeIterator)(void *cls, | |||
89 | * be errors in further edges. | 89 | * be errors in further edges. |
90 | */ | 90 | */ |
91 | int | 91 | int |
92 | REGEX_ITERNAL_block_iterate (const struct RegexBlock *block, | 92 | REGEX_INTERNAL_block_iterate (const struct RegexBlock *block, |
93 | size_t size, | 93 | size_t size, |
94 | REGEX_ITERNAL_EgdeIterator iterator, | 94 | REGEX_INTERNAL_EgdeIterator iterator, |
95 | void *iter_cls); | 95 | void *iter_cls); |
96 | 96 | ||
97 | #if 0 /* keep Emacsens' auto-indent happy */ | 97 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/regex/regex_internal.c b/src/regex/regex_internal.c index e66835134..6fda695a7 100644 --- a/src/regex/regex_internal.c +++ b/src/regex/regex_internal.c | |||
@@ -39,17 +39,17 @@ | |||
39 | /** | 39 | /** |
40 | * Set of states using MDLL API. | 40 | * Set of states using MDLL API. |
41 | */ | 41 | */ |
42 | struct REGEX_ITERNAL_StateSet_MDLL | 42 | struct REGEX_INTERNAL_StateSet_MDLL |
43 | { | 43 | { |
44 | /** | 44 | /** |
45 | * MDLL of states. | 45 | * MDLL of states. |
46 | */ | 46 | */ |
47 | struct REGEX_ITERNAL_State *head; | 47 | struct REGEX_INTERNAL_State *head; |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * MDLL of states. | 50 | * MDLL of states. |
51 | */ | 51 | */ |
52 | struct REGEX_ITERNAL_State *tail; | 52 | struct REGEX_INTERNAL_State *tail; |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * Length of the MDLL. | 55 | * Length of the MDLL. |
@@ -65,8 +65,8 @@ struct REGEX_ITERNAL_StateSet_MDLL | |||
65 | * @param state state to be appended | 65 | * @param state state to be appended |
66 | */ | 66 | */ |
67 | static void | 67 | static void |
68 | state_set_append (struct REGEX_ITERNAL_StateSet *set, | 68 | state_set_append (struct REGEX_INTERNAL_StateSet *set, |
69 | struct REGEX_ITERNAL_State *state) | 69 | struct REGEX_INTERNAL_State *state) |
70 | { | 70 | { |
71 | if (set->off == set->size) | 71 | if (set->off == set->size) |
72 | GNUNET_array_grow (set->states, set->size, set->size * 2 + 4); | 72 | GNUNET_array_grow (set->states, set->size, set->size * 2 + 4); |
@@ -104,12 +104,12 @@ nullstrcmp (const char *str1, const char *str2) | |||
104 | * @param to_state state to where the transition should point to | 104 | * @param to_state state to where the transition should point to |
105 | */ | 105 | */ |
106 | static void | 106 | static void |
107 | state_add_transition (struct REGEX_ITERNAL_Context *ctx, | 107 | state_add_transition (struct REGEX_INTERNAL_Context *ctx, |
108 | struct REGEX_ITERNAL_State *from_state, const char *label, | 108 | struct REGEX_INTERNAL_State *from_state, const char *label, |
109 | struct REGEX_ITERNAL_State *to_state) | 109 | struct REGEX_INTERNAL_State *to_state) |
110 | { | 110 | { |
111 | struct REGEX_ITERNAL_Transition *t; | 111 | struct REGEX_INTERNAL_Transition *t; |
112 | struct REGEX_ITERNAL_Transition *oth; | 112 | struct REGEX_INTERNAL_Transition *oth; |
113 | 113 | ||
114 | if (NULL == from_state) | 114 | if (NULL == from_state) |
115 | { | 115 | { |
@@ -132,7 +132,7 @@ state_add_transition (struct REGEX_ITERNAL_Context *ctx, | |||
132 | break; | 132 | break; |
133 | } | 133 | } |
134 | 134 | ||
135 | t = GNUNET_malloc (sizeof (struct REGEX_ITERNAL_Transition)); | 135 | t = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Transition)); |
136 | if (NULL != ctx) | 136 | if (NULL != ctx) |
137 | t->id = ctx->transition_id++; | 137 | t->id = ctx->transition_id++; |
138 | if (NULL != label) | 138 | if (NULL != label) |
@@ -156,8 +156,8 @@ state_add_transition (struct REGEX_ITERNAL_Context *ctx, | |||
156 | * @param transition transition that should be removed from state 'state'. | 156 | * @param transition transition that should be removed from state 'state'. |
157 | */ | 157 | */ |
158 | static void | 158 | static void |
159 | state_remove_transition (struct REGEX_ITERNAL_State *state, | 159 | state_remove_transition (struct REGEX_INTERNAL_State *state, |
160 | struct REGEX_ITERNAL_Transition *transition) | 160 | struct REGEX_INTERNAL_Transition *transition) |
161 | { | 161 | { |
162 | if (NULL == state || NULL == transition) | 162 | if (NULL == state || NULL == transition) |
163 | return; | 163 | return; |
@@ -188,8 +188,8 @@ state_remove_transition (struct REGEX_ITERNAL_State *state, | |||
188 | static int | 188 | static int |
189 | state_compare (const void *a, const void *b) | 189 | state_compare (const void *a, const void *b) |
190 | { | 190 | { |
191 | struct REGEX_ITERNAL_State **s1 = (struct REGEX_ITERNAL_State **) a; | 191 | struct REGEX_INTERNAL_State **s1 = (struct REGEX_INTERNAL_State **) a; |
192 | struct REGEX_ITERNAL_State **s2 = (struct REGEX_ITERNAL_State **) b; | 192 | struct REGEX_INTERNAL_State **s2 = (struct REGEX_INTERNAL_State **) b; |
193 | 193 | ||
194 | return (*s1)->id - (*s2)->id; | 194 | return (*s1)->id - (*s2)->id; |
195 | } | 195 | } |
@@ -205,9 +205,9 @@ state_compare (const void *a, const void *b) | |||
205 | * @return number of edges. | 205 | * @return number of edges. |
206 | */ | 206 | */ |
207 | static unsigned int | 207 | static unsigned int |
208 | state_get_edges (struct REGEX_ITERNAL_State *s, struct REGEX_ITERNAL_Edge *edges) | 208 | state_get_edges (struct REGEX_INTERNAL_State *s, struct REGEX_INTERNAL_Edge *edges) |
209 | { | 209 | { |
210 | struct REGEX_ITERNAL_Transition *t; | 210 | struct REGEX_INTERNAL_Transition *t; |
211 | unsigned int count; | 211 | unsigned int count; |
212 | 212 | ||
213 | if (NULL == s) | 213 | if (NULL == s) |
@@ -237,8 +237,8 @@ state_get_edges (struct REGEX_ITERNAL_State *s, struct REGEX_ITERNAL_Edge *edges | |||
237 | * @return 0 if the sets are equal, otherwise non-zero | 237 | * @return 0 if the sets are equal, otherwise non-zero |
238 | */ | 238 | */ |
239 | static int | 239 | static int |
240 | state_set_compare (struct REGEX_ITERNAL_StateSet *sset1, | 240 | state_set_compare (struct REGEX_INTERNAL_StateSet *sset1, |
241 | struct REGEX_ITERNAL_StateSet *sset2) | 241 | struct REGEX_INTERNAL_StateSet *sset2) |
242 | { | 242 | { |
243 | int result; | 243 | int result; |
244 | unsigned int i; | 244 | unsigned int i; |
@@ -264,7 +264,7 @@ state_set_compare (struct REGEX_ITERNAL_StateSet *sset1, | |||
264 | * @param set set to be cleared | 264 | * @param set set to be cleared |
265 | */ | 265 | */ |
266 | static void | 266 | static void |
267 | state_set_clear (struct REGEX_ITERNAL_StateSet *set) | 267 | state_set_clear (struct REGEX_INTERNAL_StateSet *set) |
268 | { | 268 | { |
269 | GNUNET_array_grow (set->states, set->size, 0); | 269 | GNUNET_array_grow (set->states, set->size, 0); |
270 | set->off = 0; | 270 | set->off = 0; |
@@ -278,7 +278,7 @@ state_set_clear (struct REGEX_ITERNAL_StateSet *set) | |||
278 | * @param a automaton to be cleared | 278 | * @param a automaton to be cleared |
279 | */ | 279 | */ |
280 | static void | 280 | static void |
281 | automaton_fragment_clear (struct REGEX_ITERNAL_Automaton *a) | 281 | automaton_fragment_clear (struct REGEX_INTERNAL_Automaton *a) |
282 | { | 282 | { |
283 | if (NULL == a) | 283 | if (NULL == a) |
284 | return; | 284 | return; |
@@ -298,10 +298,10 @@ automaton_fragment_clear (struct REGEX_ITERNAL_Automaton *a) | |||
298 | * @param s state that should be destroyed | 298 | * @param s state that should be destroyed |
299 | */ | 299 | */ |
300 | static void | 300 | static void |
301 | automaton_destroy_state (struct REGEX_ITERNAL_State *s) | 301 | automaton_destroy_state (struct REGEX_INTERNAL_State *s) |
302 | { | 302 | { |
303 | struct REGEX_ITERNAL_Transition *t; | 303 | struct REGEX_INTERNAL_Transition *t; |
304 | struct REGEX_ITERNAL_Transition *next_t; | 304 | struct REGEX_INTERNAL_Transition *next_t; |
305 | 305 | ||
306 | if (NULL == s) | 306 | if (NULL == s) |
307 | return; | 307 | return; |
@@ -328,12 +328,12 @@ automaton_destroy_state (struct REGEX_ITERNAL_State *s) | |||
328 | * @param s state to remove | 328 | * @param s state to remove |
329 | */ | 329 | */ |
330 | static void | 330 | static void |
331 | automaton_remove_state (struct REGEX_ITERNAL_Automaton *a, | 331 | automaton_remove_state (struct REGEX_INTERNAL_Automaton *a, |
332 | struct REGEX_ITERNAL_State *s) | 332 | struct REGEX_INTERNAL_State *s) |
333 | { | 333 | { |
334 | struct REGEX_ITERNAL_State *s_check; | 334 | struct REGEX_INTERNAL_State *s_check; |
335 | struct REGEX_ITERNAL_Transition *t_check; | 335 | struct REGEX_INTERNAL_Transition *t_check; |
336 | struct REGEX_ITERNAL_Transition *t_check_next; | 336 | struct REGEX_INTERNAL_Transition *t_check_next; |
337 | 337 | ||
338 | if (NULL == a || NULL == s) | 338 | if (NULL == a || NULL == s) |
339 | return; | 339 | return; |
@@ -368,15 +368,15 @@ automaton_remove_state (struct REGEX_ITERNAL_Automaton *a, | |||
368 | * @param s2 second state, will be destroyed | 368 | * @param s2 second state, will be destroyed |
369 | */ | 369 | */ |
370 | static void | 370 | static void |
371 | automaton_merge_states (struct REGEX_ITERNAL_Context *ctx, | 371 | automaton_merge_states (struct REGEX_INTERNAL_Context *ctx, |
372 | struct REGEX_ITERNAL_Automaton *a, | 372 | struct REGEX_INTERNAL_Automaton *a, |
373 | struct REGEX_ITERNAL_State *s1, | 373 | struct REGEX_INTERNAL_State *s1, |
374 | struct REGEX_ITERNAL_State *s2) | 374 | struct REGEX_INTERNAL_State *s2) |
375 | { | 375 | { |
376 | struct REGEX_ITERNAL_State *s_check; | 376 | struct REGEX_INTERNAL_State *s_check; |
377 | struct REGEX_ITERNAL_Transition *t_check; | 377 | struct REGEX_INTERNAL_Transition *t_check; |
378 | struct REGEX_ITERNAL_Transition *t; | 378 | struct REGEX_INTERNAL_Transition *t; |
379 | struct REGEX_ITERNAL_Transition *t_next; | 379 | struct REGEX_INTERNAL_Transition *t_next; |
380 | int is_dup; | 380 | int is_dup; |
381 | 381 | ||
382 | if (s1 == s2) | 382 | if (s1 == s2) |
@@ -437,8 +437,8 @@ automaton_merge_states (struct REGEX_ITERNAL_Context *ctx, | |||
437 | * @param s state that should be added | 437 | * @param s state that should be added |
438 | */ | 438 | */ |
439 | static void | 439 | static void |
440 | automaton_add_state (struct REGEX_ITERNAL_Automaton *a, | 440 | automaton_add_state (struct REGEX_INTERNAL_Automaton *a, |
441 | struct REGEX_ITERNAL_State *s) | 441 | struct REGEX_INTERNAL_State *s) |
442 | { | 442 | { |
443 | GNUNET_CONTAINER_DLL_insert (a->states_head, a->states_tail, s); | 443 | GNUNET_CONTAINER_DLL_insert (a->states_head, a->states_tail, s); |
444 | a->state_count++; | 444 | a->state_count++; |
@@ -460,12 +460,12 @@ automaton_add_state (struct REGEX_ITERNAL_Automaton *a, | |||
460 | * @param action_cls closure for action. | 460 | * @param action_cls closure for action. |
461 | */ | 461 | */ |
462 | static void | 462 | static void |
463 | automaton_state_traverse (struct REGEX_ITERNAL_State *s, int *marks, | 463 | automaton_state_traverse (struct REGEX_INTERNAL_State *s, int *marks, |
464 | unsigned int *count, | 464 | unsigned int *count, |
465 | REGEX_ITERNAL_traverse_check check, void *check_cls, | 465 | REGEX_INTERNAL_traverse_check check, void *check_cls, |
466 | REGEX_ITERNAL_traverse_action action, void *action_cls) | 466 | REGEX_INTERNAL_traverse_action action, void *action_cls) |
467 | { | 467 | { |
468 | struct REGEX_ITERNAL_Transition *t; | 468 | struct REGEX_INTERNAL_Transition *t; |
469 | 469 | ||
470 | if (GNUNET_YES == marks[s->traversal_id]) | 470 | if (GNUNET_YES == marks[s->traversal_id]) |
471 | return; | 471 | return; |
@@ -503,15 +503,15 @@ automaton_state_traverse (struct REGEX_ITERNAL_State *s, int *marks, | |||
503 | * @param action_cls closure for action | 503 | * @param action_cls closure for action |
504 | */ | 504 | */ |
505 | void | 505 | void |
506 | REGEX_ITERNAL_automaton_traverse (const struct REGEX_ITERNAL_Automaton *a, | 506 | REGEX_INTERNAL_automaton_traverse (const struct REGEX_INTERNAL_Automaton *a, |
507 | struct REGEX_ITERNAL_State *start, | 507 | struct REGEX_INTERNAL_State *start, |
508 | REGEX_ITERNAL_traverse_check check, | 508 | REGEX_INTERNAL_traverse_check check, |
509 | void *check_cls, | 509 | void *check_cls, |
510 | REGEX_ITERNAL_traverse_action action, | 510 | REGEX_INTERNAL_traverse_action action, |
511 | void *action_cls) | 511 | void *action_cls) |
512 | { | 512 | { |
513 | unsigned int count; | 513 | unsigned int count; |
514 | struct REGEX_ITERNAL_State *s; | 514 | struct REGEX_INTERNAL_State *s; |
515 | 515 | ||
516 | if (NULL == a || 0 == a->state_count) | 516 | if (NULL == a || 0 == a->state_count) |
517 | return; | 517 | return; |
@@ -1156,7 +1156,7 @@ sb_strkcmp (const struct StringBuffer *str1, | |||
1156 | 1156 | ||
1157 | 1157 | ||
1158 | /** | 1158 | /** |
1159 | * Helper function used as 'action' in 'REGEX_ITERNAL_automaton_traverse' | 1159 | * Helper function used as 'action' in 'REGEX_INTERNAL_automaton_traverse' |
1160 | * function to create the depth-first numbering of the states. | 1160 | * function to create the depth-first numbering of the states. |
1161 | * | 1161 | * |
1162 | * @param cls states array. | 1162 | * @param cls states array. |
@@ -1165,9 +1165,9 @@ sb_strkcmp (const struct StringBuffer *str1, | |||
1165 | */ | 1165 | */ |
1166 | static void | 1166 | static void |
1167 | number_states (void *cls, const unsigned int count, | 1167 | number_states (void *cls, const unsigned int count, |
1168 | struct REGEX_ITERNAL_State *s) | 1168 | struct REGEX_INTERNAL_State *s) |
1169 | { | 1169 | { |
1170 | struct REGEX_ITERNAL_State **states = cls; | 1170 | struct REGEX_INTERNAL_State **states = cls; |
1171 | 1171 | ||
1172 | s->dfs_id = count; | 1172 | s->dfs_id = count; |
1173 | if (NULL != states) | 1173 | if (NULL != states) |
@@ -1604,16 +1604,16 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij, | |||
1604 | * @param a automaton for which to assign proofs and hashes, must not be NULL | 1604 | * @param a automaton for which to assign proofs and hashes, must not be NULL |
1605 | */ | 1605 | */ |
1606 | static int | 1606 | static int |
1607 | automaton_create_proofs (struct REGEX_ITERNAL_Automaton *a) | 1607 | automaton_create_proofs (struct REGEX_INTERNAL_Automaton *a) |
1608 | { | 1608 | { |
1609 | unsigned int n = a->state_count; | 1609 | unsigned int n = a->state_count; |
1610 | struct REGEX_ITERNAL_State *states[n]; | 1610 | struct REGEX_INTERNAL_State *states[n]; |
1611 | struct StringBuffer *R_last; | 1611 | struct StringBuffer *R_last; |
1612 | struct StringBuffer *R_cur; | 1612 | struct StringBuffer *R_cur; |
1613 | struct StringBuffer R_cur_r; | 1613 | struct StringBuffer R_cur_r; |
1614 | struct StringBuffer R_cur_l; | 1614 | struct StringBuffer R_cur_l; |
1615 | struct StringBuffer *R_swap; | 1615 | struct StringBuffer *R_swap; |
1616 | struct REGEX_ITERNAL_Transition *t; | 1616 | struct REGEX_INTERNAL_Transition *t; |
1617 | struct StringBuffer complete_regex; | 1617 | struct StringBuffer complete_regex; |
1618 | unsigned int i; | 1618 | unsigned int i; |
1619 | unsigned int j; | 1619 | unsigned int j; |
@@ -1631,7 +1631,7 @@ automaton_create_proofs (struct REGEX_ITERNAL_Automaton *a) | |||
1631 | } | 1631 | } |
1632 | 1632 | ||
1633 | /* create depth-first numbering of the states, initializes 'state' */ | 1633 | /* create depth-first numbering of the states, initializes 'state' */ |
1634 | REGEX_ITERNAL_automaton_traverse (a, a->start, NULL, NULL, &number_states, | 1634 | REGEX_INTERNAL_automaton_traverse (a, a->start, NULL, NULL, &number_states, |
1635 | states); | 1635 | states); |
1636 | 1636 | ||
1637 | for (i = 0; i < n; i++) | 1637 | for (i = 0; i < n; i++) |
@@ -1763,18 +1763,18 @@ automaton_create_proofs (struct REGEX_ITERNAL_Automaton *a) | |||
1763 | * | 1763 | * |
1764 | * @return new DFA state | 1764 | * @return new DFA state |
1765 | */ | 1765 | */ |
1766 | static struct REGEX_ITERNAL_State * | 1766 | static struct REGEX_INTERNAL_State * |
1767 | dfa_state_create (struct REGEX_ITERNAL_Context *ctx, | 1767 | dfa_state_create (struct REGEX_INTERNAL_Context *ctx, |
1768 | struct REGEX_ITERNAL_StateSet *nfa_states) | 1768 | struct REGEX_INTERNAL_StateSet *nfa_states) |
1769 | { | 1769 | { |
1770 | struct REGEX_ITERNAL_State *s; | 1770 | struct REGEX_INTERNAL_State *s; |
1771 | char *pos; | 1771 | char *pos; |
1772 | size_t len; | 1772 | size_t len; |
1773 | struct REGEX_ITERNAL_State *cstate; | 1773 | struct REGEX_INTERNAL_State *cstate; |
1774 | struct REGEX_ITERNAL_Transition *ctran; | 1774 | struct REGEX_INTERNAL_Transition *ctran; |
1775 | unsigned int i; | 1775 | unsigned int i; |
1776 | 1776 | ||
1777 | s = GNUNET_malloc (sizeof (struct REGEX_ITERNAL_State)); | 1777 | s = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_State)); |
1778 | s->id = ctx->state_id++; | 1778 | s->id = ctx->state_id++; |
1779 | s->index = -1; | 1779 | s->index = -1; |
1780 | s->lowlink = -1; | 1780 | s->lowlink = -1; |
@@ -1816,7 +1816,7 @@ dfa_state_create (struct REGEX_ITERNAL_Context *ctx, | |||
1816 | pos[-1] = '}'; | 1816 | pos[-1] = '}'; |
1817 | s->name = GNUNET_realloc (s->name, strlen (s->name) + 1); | 1817 | s->name = GNUNET_realloc (s->name, strlen (s->name) + 1); |
1818 | 1818 | ||
1819 | memset (nfa_states, 0, sizeof (struct REGEX_ITERNAL_StateSet)); | 1819 | memset (nfa_states, 0, sizeof (struct REGEX_INTERNAL_StateSet)); |
1820 | return s; | 1820 | return s; |
1821 | } | 1821 | } |
1822 | 1822 | ||
@@ -1835,10 +1835,10 @@ dfa_state_create (struct REGEX_ITERNAL_Context *ctx, | |||
1835 | * @return length of the substring comsumed from 'str' | 1835 | * @return length of the substring comsumed from 'str' |
1836 | */ | 1836 | */ |
1837 | static unsigned int | 1837 | static unsigned int |
1838 | dfa_move (struct REGEX_ITERNAL_State **s, const char *str) | 1838 | dfa_move (struct REGEX_INTERNAL_State **s, const char *str) |
1839 | { | 1839 | { |
1840 | struct REGEX_ITERNAL_Transition *t; | 1840 | struct REGEX_INTERNAL_Transition *t; |
1841 | struct REGEX_ITERNAL_State *new_s; | 1841 | struct REGEX_INTERNAL_State *new_s; |
1842 | unsigned int len; | 1842 | unsigned int len; |
1843 | unsigned int max_len; | 1843 | unsigned int max_len; |
1844 | 1844 | ||
@@ -1876,7 +1876,7 @@ dfa_move (struct REGEX_ITERNAL_State **s, const char *str) | |||
1876 | * @param s state where the marked attribute will be set to GNUNET_YES. | 1876 | * @param s state where the marked attribute will be set to GNUNET_YES. |
1877 | */ | 1877 | */ |
1878 | static void | 1878 | static void |
1879 | mark_states (void *cls, const unsigned int count, struct REGEX_ITERNAL_State *s) | 1879 | mark_states (void *cls, const unsigned int count, struct REGEX_INTERNAL_State *s) |
1880 | { | 1880 | { |
1881 | s->marked = GNUNET_YES; | 1881 | s->marked = GNUNET_YES; |
1882 | } | 1882 | } |
@@ -1889,17 +1889,17 @@ mark_states (void *cls, const unsigned int count, struct REGEX_ITERNAL_State *s) | |||
1889 | * @param a DFA automaton | 1889 | * @param a DFA automaton |
1890 | */ | 1890 | */ |
1891 | static void | 1891 | static void |
1892 | dfa_remove_unreachable_states (struct REGEX_ITERNAL_Automaton *a) | 1892 | dfa_remove_unreachable_states (struct REGEX_INTERNAL_Automaton *a) |
1893 | { | 1893 | { |
1894 | struct REGEX_ITERNAL_State *s; | 1894 | struct REGEX_INTERNAL_State *s; |
1895 | struct REGEX_ITERNAL_State *s_next; | 1895 | struct REGEX_INTERNAL_State *s_next; |
1896 | 1896 | ||
1897 | /* 1. unmark all states */ | 1897 | /* 1. unmark all states */ |
1898 | for (s = a->states_head; NULL != s; s = s->next) | 1898 | for (s = a->states_head; NULL != s; s = s->next) |
1899 | s->marked = GNUNET_NO; | 1899 | s->marked = GNUNET_NO; |
1900 | 1900 | ||
1901 | /* 2. traverse dfa from start state and mark all visited states */ | 1901 | /* 2. traverse dfa from start state and mark all visited states */ |
1902 | REGEX_ITERNAL_automaton_traverse (a, a->start, NULL, NULL, &mark_states, NULL); | 1902 | REGEX_INTERNAL_automaton_traverse (a, a->start, NULL, NULL, &mark_states, NULL); |
1903 | 1903 | ||
1904 | /* 3. delete all states that were not visited */ | 1904 | /* 3. delete all states that were not visited */ |
1905 | for (s = a->states_head; NULL != s; s = s_next) | 1905 | for (s = a->states_head; NULL != s; s = s_next) |
@@ -1918,11 +1918,11 @@ dfa_remove_unreachable_states (struct REGEX_ITERNAL_Automaton *a) | |||
1918 | * @param a DFA automaton | 1918 | * @param a DFA automaton |
1919 | */ | 1919 | */ |
1920 | static void | 1920 | static void |
1921 | dfa_remove_dead_states (struct REGEX_ITERNAL_Automaton *a) | 1921 | dfa_remove_dead_states (struct REGEX_INTERNAL_Automaton *a) |
1922 | { | 1922 | { |
1923 | struct REGEX_ITERNAL_State *s; | 1923 | struct REGEX_INTERNAL_State *s; |
1924 | struct REGEX_ITERNAL_State *s_next; | 1924 | struct REGEX_INTERNAL_State *s_next; |
1925 | struct REGEX_ITERNAL_Transition *t; | 1925 | struct REGEX_INTERNAL_Transition *t; |
1926 | int dead; | 1926 | int dead; |
1927 | 1927 | ||
1928 | GNUNET_assert (DFA == a->type); | 1928 | GNUNET_assert (DFA == a->type); |
@@ -1961,16 +1961,16 @@ dfa_remove_dead_states (struct REGEX_ITERNAL_Automaton *a) | |||
1961 | * @return GNUNET_OK on success | 1961 | * @return GNUNET_OK on success |
1962 | */ | 1962 | */ |
1963 | static int | 1963 | static int |
1964 | dfa_merge_nondistinguishable_states (struct REGEX_ITERNAL_Context *ctx, | 1964 | dfa_merge_nondistinguishable_states (struct REGEX_INTERNAL_Context *ctx, |
1965 | struct REGEX_ITERNAL_Automaton *a) | 1965 | struct REGEX_INTERNAL_Automaton *a) |
1966 | { | 1966 | { |
1967 | uint32_t *table; | 1967 | uint32_t *table; |
1968 | struct REGEX_ITERNAL_State *s1; | 1968 | struct REGEX_INTERNAL_State *s1; |
1969 | struct REGEX_ITERNAL_State *s2; | 1969 | struct REGEX_INTERNAL_State *s2; |
1970 | struct REGEX_ITERNAL_Transition *t1; | 1970 | struct REGEX_INTERNAL_Transition *t1; |
1971 | struct REGEX_ITERNAL_Transition *t2; | 1971 | struct REGEX_INTERNAL_Transition *t2; |
1972 | struct REGEX_ITERNAL_State *s1_next; | 1972 | struct REGEX_INTERNAL_State *s1_next; |
1973 | struct REGEX_ITERNAL_State *s2_next; | 1973 | struct REGEX_INTERNAL_State *s2_next; |
1974 | int change; | 1974 | int change; |
1975 | unsigned int num_equal_edges; | 1975 | unsigned int num_equal_edges; |
1976 | unsigned int i; | 1976 | unsigned int i; |
@@ -2078,8 +2078,8 @@ dfa_merge_nondistinguishable_states (struct REGEX_ITERNAL_Context *ctx, | |||
2078 | * @return GNUNET_OK on success | 2078 | * @return GNUNET_OK on success |
2079 | */ | 2079 | */ |
2080 | static int | 2080 | static int |
2081 | dfa_minimize (struct REGEX_ITERNAL_Context *ctx, | 2081 | dfa_minimize (struct REGEX_INTERNAL_Context *ctx, |
2082 | struct REGEX_ITERNAL_Automaton *a) | 2082 | struct REGEX_INTERNAL_Automaton *a) |
2083 | { | 2083 | { |
2084 | if (NULL == a) | 2084 | if (NULL == a) |
2085 | return GNUNET_SYSERR; | 2085 | return GNUNET_SYSERR; |
@@ -2102,7 +2102,7 @@ dfa_minimize (struct REGEX_ITERNAL_Context *ctx, | |||
2102 | /** | 2102 | /** |
2103 | * Context for adding strided transitions to a DFA. | 2103 | * Context for adding strided transitions to a DFA. |
2104 | */ | 2104 | */ |
2105 | struct REGEX_ITERNAL_Strided_Context | 2105 | struct REGEX_INTERNAL_Strided_Context |
2106 | { | 2106 | { |
2107 | /** | 2107 | /** |
2108 | * Length of the strides. | 2108 | * Length of the strides. |
@@ -2113,12 +2113,12 @@ struct REGEX_ITERNAL_Strided_Context | |||
2113 | * Strided transitions DLL. New strided transitions will be stored in this DLL | 2113 | * Strided transitions DLL. New strided transitions will be stored in this DLL |
2114 | * and afterwards added to the DFA. | 2114 | * and afterwards added to the DFA. |
2115 | */ | 2115 | */ |
2116 | struct REGEX_ITERNAL_Transition *transitions_head; | 2116 | struct REGEX_INTERNAL_Transition *transitions_head; |
2117 | 2117 | ||
2118 | /** | 2118 | /** |
2119 | * Strided transitions DLL. | 2119 | * Strided transitions DLL. |
2120 | */ | 2120 | */ |
2121 | struct REGEX_ITERNAL_Transition *transitions_tail; | 2121 | struct REGEX_INTERNAL_Transition *transitions_tail; |
2122 | }; | 2122 | }; |
2123 | 2123 | ||
2124 | 2124 | ||
@@ -2134,16 +2134,16 @@ struct REGEX_ITERNAL_Strided_Context | |||
2134 | */ | 2134 | */ |
2135 | void | 2135 | void |
2136 | dfa_add_multi_strides_helper (void *cls, const unsigned int depth, char *label, | 2136 | dfa_add_multi_strides_helper (void *cls, const unsigned int depth, char *label, |
2137 | struct REGEX_ITERNAL_State *start, | 2137 | struct REGEX_INTERNAL_State *start, |
2138 | struct REGEX_ITERNAL_State *s) | 2138 | struct REGEX_INTERNAL_State *s) |
2139 | { | 2139 | { |
2140 | struct REGEX_ITERNAL_Strided_Context *ctx = cls; | 2140 | struct REGEX_INTERNAL_Strided_Context *ctx = cls; |
2141 | struct REGEX_ITERNAL_Transition *t; | 2141 | struct REGEX_INTERNAL_Transition *t; |
2142 | char *new_label; | 2142 | char *new_label; |
2143 | 2143 | ||
2144 | if (depth == ctx->stride) | 2144 | if (depth == ctx->stride) |
2145 | { | 2145 | { |
2146 | t = GNUNET_malloc (sizeof (struct REGEX_ITERNAL_Transition)); | 2146 | t = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Transition)); |
2147 | t->label = GNUNET_strdup (label); | 2147 | t->label = GNUNET_strdup (label); |
2148 | t->to_state = s; | 2148 | t->to_state = s; |
2149 | t->from_state = start; | 2149 | t->from_state = start; |
@@ -2184,7 +2184,7 @@ dfa_add_multi_strides_helper (void *cls, const unsigned int depth, char *label, | |||
2184 | */ | 2184 | */ |
2185 | void | 2185 | void |
2186 | dfa_add_multi_strides (void *cls, const unsigned int count, | 2186 | dfa_add_multi_strides (void *cls, const unsigned int count, |
2187 | struct REGEX_ITERNAL_State *s) | 2187 | struct REGEX_INTERNAL_State *s) |
2188 | { | 2188 | { |
2189 | dfa_add_multi_strides_helper (cls, 0, NULL, s, s); | 2189 | dfa_add_multi_strides_helper (cls, 0, NULL, s, s); |
2190 | } | 2190 | } |
@@ -2198,19 +2198,19 @@ dfa_add_multi_strides (void *cls, const unsigned int count, | |||
2198 | * @param stride_len length of the strides. | 2198 | * @param stride_len length of the strides. |
2199 | */ | 2199 | */ |
2200 | void | 2200 | void |
2201 | REGEX_ITERNAL_dfa_add_multi_strides (struct REGEX_ITERNAL_Context *regex_ctx, | 2201 | REGEX_INTERNAL_dfa_add_multi_strides (struct REGEX_INTERNAL_Context *regex_ctx, |
2202 | struct REGEX_ITERNAL_Automaton *dfa, | 2202 | struct REGEX_INTERNAL_Automaton *dfa, |
2203 | const unsigned int stride_len) | 2203 | const unsigned int stride_len) |
2204 | { | 2204 | { |
2205 | struct REGEX_ITERNAL_Strided_Context ctx = { stride_len, NULL, NULL }; | 2205 | struct REGEX_INTERNAL_Strided_Context ctx = { stride_len, NULL, NULL }; |
2206 | struct REGEX_ITERNAL_Transition *t; | 2206 | struct REGEX_INTERNAL_Transition *t; |
2207 | struct REGEX_ITERNAL_Transition *t_next; | 2207 | struct REGEX_INTERNAL_Transition *t_next; |
2208 | 2208 | ||
2209 | if (1 > stride_len || GNUNET_YES == dfa->is_multistrided) | 2209 | if (1 > stride_len || GNUNET_YES == dfa->is_multistrided) |
2210 | return; | 2210 | return; |
2211 | 2211 | ||
2212 | /* Compute the new transitions of given stride_len */ | 2212 | /* Compute the new transitions of given stride_len */ |
2213 | REGEX_ITERNAL_automaton_traverse (dfa, dfa->start, NULL, NULL, | 2213 | REGEX_INTERNAL_automaton_traverse (dfa, dfa->start, NULL, NULL, |
2214 | &dfa_add_multi_strides, &ctx); | 2214 | &dfa_add_multi_strides, &ctx); |
2215 | 2215 | ||
2216 | /* Add all the new transitions to the automaton. */ | 2216 | /* Add all the new transitions to the automaton. */ |
@@ -2241,14 +2241,14 @@ REGEX_ITERNAL_dfa_add_multi_strides (struct REGEX_ITERNAL_Context *regex_ctx, | |||
2241 | * @param transitions_tail transitions DLL. | 2241 | * @param transitions_tail transitions DLL. |
2242 | */ | 2242 | */ |
2243 | void | 2243 | void |
2244 | dfa_compress_paths_helper (struct REGEX_ITERNAL_Automaton *dfa, | 2244 | dfa_compress_paths_helper (struct REGEX_INTERNAL_Automaton *dfa, |
2245 | struct REGEX_ITERNAL_State *start, | 2245 | struct REGEX_INTERNAL_State *start, |
2246 | struct REGEX_ITERNAL_State *cur, char *label, | 2246 | struct REGEX_INTERNAL_State *cur, char *label, |
2247 | unsigned int max_len, | 2247 | unsigned int max_len, |
2248 | struct REGEX_ITERNAL_Transition **transitions_head, | 2248 | struct REGEX_INTERNAL_Transition **transitions_head, |
2249 | struct REGEX_ITERNAL_Transition **transitions_tail) | 2249 | struct REGEX_INTERNAL_Transition **transitions_tail) |
2250 | { | 2250 | { |
2251 | struct REGEX_ITERNAL_Transition *t; | 2251 | struct REGEX_INTERNAL_Transition *t; |
2252 | char *new_label; | 2252 | char *new_label; |
2253 | 2253 | ||
2254 | 2254 | ||
@@ -2258,7 +2258,7 @@ dfa_compress_paths_helper (struct REGEX_ITERNAL_Automaton *dfa, | |||
2258 | max_len == strlen (label)) || | 2258 | max_len == strlen (label)) || |
2259 | (start == dfa->start && GNUNET_REGEX_INITIAL_BYTES == strlen (label)))) | 2259 | (start == dfa->start && GNUNET_REGEX_INITIAL_BYTES == strlen (label)))) |
2260 | { | 2260 | { |
2261 | t = GNUNET_malloc (sizeof (struct REGEX_ITERNAL_Transition)); | 2261 | t = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Transition)); |
2262 | t->label = GNUNET_strdup (label); | 2262 | t->label = GNUNET_strdup (label); |
2263 | t->to_state = cur; | 2263 | t->to_state = cur; |
2264 | t->from_state = start; | 2264 | t->from_state = start; |
@@ -2306,15 +2306,15 @@ dfa_compress_paths_helper (struct REGEX_ITERNAL_Automaton *dfa, | |||
2306 | * @param max_len maximal length of the compressed paths. | 2306 | * @param max_len maximal length of the compressed paths. |
2307 | */ | 2307 | */ |
2308 | static void | 2308 | static void |
2309 | dfa_compress_paths (struct REGEX_ITERNAL_Context *regex_ctx, | 2309 | dfa_compress_paths (struct REGEX_INTERNAL_Context *regex_ctx, |
2310 | struct REGEX_ITERNAL_Automaton *dfa, unsigned int max_len) | 2310 | struct REGEX_INTERNAL_Automaton *dfa, unsigned int max_len) |
2311 | { | 2311 | { |
2312 | struct REGEX_ITERNAL_State *s; | 2312 | struct REGEX_INTERNAL_State *s; |
2313 | struct REGEX_ITERNAL_State *s_next; | 2313 | struct REGEX_INTERNAL_State *s_next; |
2314 | struct REGEX_ITERNAL_Transition *t; | 2314 | struct REGEX_INTERNAL_Transition *t; |
2315 | struct REGEX_ITERNAL_Transition *t_next; | 2315 | struct REGEX_INTERNAL_Transition *t_next; |
2316 | struct REGEX_ITERNAL_Transition *transitions_head = NULL; | 2316 | struct REGEX_INTERNAL_Transition *transitions_head = NULL; |
2317 | struct REGEX_ITERNAL_Transition *transitions_tail = NULL; | 2317 | struct REGEX_INTERNAL_Transition *transitions_tail = NULL; |
2318 | 2318 | ||
2319 | if (NULL == dfa) | 2319 | if (NULL == dfa) |
2320 | return; | 2320 | return; |
@@ -2369,13 +2369,13 @@ dfa_compress_paths (struct REGEX_ITERNAL_Context *regex_ctx, | |||
2369 | * | 2369 | * |
2370 | * @return new NFA fragment | 2370 | * @return new NFA fragment |
2371 | */ | 2371 | */ |
2372 | static struct REGEX_ITERNAL_Automaton * | 2372 | static struct REGEX_INTERNAL_Automaton * |
2373 | nfa_fragment_create (struct REGEX_ITERNAL_State *start, | 2373 | nfa_fragment_create (struct REGEX_INTERNAL_State *start, |
2374 | struct REGEX_ITERNAL_State *end) | 2374 | struct REGEX_INTERNAL_State *end) |
2375 | { | 2375 | { |
2376 | struct REGEX_ITERNAL_Automaton *n; | 2376 | struct REGEX_INTERNAL_Automaton *n; |
2377 | 2377 | ||
2378 | n = GNUNET_malloc (sizeof (struct REGEX_ITERNAL_Automaton)); | 2378 | n = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Automaton)); |
2379 | 2379 | ||
2380 | n->type = NFA; | 2380 | n->type = NFA; |
2381 | n->start = NULL; | 2381 | n->start = NULL; |
@@ -2405,11 +2405,11 @@ nfa_fragment_create (struct REGEX_ITERNAL_State *start, | |||
2405 | * @param states_tail tail of the DLL of states | 2405 | * @param states_tail tail of the DLL of states |
2406 | */ | 2406 | */ |
2407 | static void | 2407 | static void |
2408 | nfa_add_states (struct REGEX_ITERNAL_Automaton *n, | 2408 | nfa_add_states (struct REGEX_INTERNAL_Automaton *n, |
2409 | struct REGEX_ITERNAL_State *states_head, | 2409 | struct REGEX_INTERNAL_State *states_head, |
2410 | struct REGEX_ITERNAL_State *states_tail) | 2410 | struct REGEX_INTERNAL_State *states_tail) |
2411 | { | 2411 | { |
2412 | struct REGEX_ITERNAL_State *s; | 2412 | struct REGEX_INTERNAL_State *s; |
2413 | 2413 | ||
2414 | if (NULL == n || NULL == states_head) | 2414 | if (NULL == n || NULL == states_head) |
2415 | { | 2415 | { |
@@ -2443,12 +2443,12 @@ nfa_add_states (struct REGEX_ITERNAL_Automaton *n, | |||
2443 | * | 2443 | * |
2444 | * @return new NFA state | 2444 | * @return new NFA state |
2445 | */ | 2445 | */ |
2446 | static struct REGEX_ITERNAL_State * | 2446 | static struct REGEX_INTERNAL_State * |
2447 | nfa_state_create (struct REGEX_ITERNAL_Context *ctx, int accepting) | 2447 | nfa_state_create (struct REGEX_INTERNAL_Context *ctx, int accepting) |
2448 | { | 2448 | { |
2449 | struct REGEX_ITERNAL_State *s; | 2449 | struct REGEX_INTERNAL_State *s; |
2450 | 2450 | ||
2451 | s = GNUNET_malloc (sizeof (struct REGEX_ITERNAL_State)); | 2451 | s = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_State)); |
2452 | s->id = ctx->state_id++; | 2452 | s->id = ctx->state_id++; |
2453 | s->accepting = accepting; | 2453 | s->accepting = accepting; |
2454 | s->marked = GNUNET_NO; | 2454 | s->marked = GNUNET_NO; |
@@ -2473,18 +2473,18 @@ nfa_state_create (struct REGEX_ITERNAL_Context *ctx, int accepting) | |||
2473 | * pass NULL for epsilon transition | 2473 | * pass NULL for epsilon transition |
2474 | */ | 2474 | */ |
2475 | static void | 2475 | static void |
2476 | nfa_closure_set_create (struct REGEX_ITERNAL_StateSet *ret, | 2476 | nfa_closure_set_create (struct REGEX_INTERNAL_StateSet *ret, |
2477 | struct REGEX_ITERNAL_Automaton *nfa, | 2477 | struct REGEX_INTERNAL_Automaton *nfa, |
2478 | struct REGEX_ITERNAL_StateSet *states, const char *label) | 2478 | struct REGEX_INTERNAL_StateSet *states, const char *label) |
2479 | { | 2479 | { |
2480 | struct REGEX_ITERNAL_State *s; | 2480 | struct REGEX_INTERNAL_State *s; |
2481 | unsigned int i; | 2481 | unsigned int i; |
2482 | struct REGEX_ITERNAL_StateSet_MDLL cls_stack; | 2482 | struct REGEX_INTERNAL_StateSet_MDLL cls_stack; |
2483 | struct REGEX_ITERNAL_State *clsstate; | 2483 | struct REGEX_INTERNAL_State *clsstate; |
2484 | struct REGEX_ITERNAL_State *currentstate; | 2484 | struct REGEX_INTERNAL_State *currentstate; |
2485 | struct REGEX_ITERNAL_Transition *ctran; | 2485 | struct REGEX_INTERNAL_Transition *ctran; |
2486 | 2486 | ||
2487 | memset (ret, 0, sizeof (struct REGEX_ITERNAL_StateSet)); | 2487 | memset (ret, 0, sizeof (struct REGEX_INTERNAL_StateSet)); |
2488 | if (NULL == states) | 2488 | if (NULL == states) |
2489 | return; | 2489 | return; |
2490 | 2490 | ||
@@ -2528,7 +2528,7 @@ nfa_closure_set_create (struct REGEX_ITERNAL_StateSet *ret, | |||
2528 | ret->states[i]->contained = 0; | 2528 | ret->states[i]->contained = 0; |
2529 | 2529 | ||
2530 | if (ret->off > 1) | 2530 | if (ret->off > 1) |
2531 | qsort (ret->states, ret->off, sizeof (struct REGEX_ITERNAL_State *), | 2531 | qsort (ret->states, ret->off, sizeof (struct REGEX_INTERNAL_State *), |
2532 | &state_compare); | 2532 | &state_compare); |
2533 | } | 2533 | } |
2534 | 2534 | ||
@@ -2539,11 +2539,11 @@ nfa_closure_set_create (struct REGEX_ITERNAL_StateSet *ret, | |||
2539 | * @param ctx context | 2539 | * @param ctx context |
2540 | */ | 2540 | */ |
2541 | static void | 2541 | static void |
2542 | nfa_add_concatenation (struct REGEX_ITERNAL_Context *ctx) | 2542 | nfa_add_concatenation (struct REGEX_INTERNAL_Context *ctx) |
2543 | { | 2543 | { |
2544 | struct REGEX_ITERNAL_Automaton *a; | 2544 | struct REGEX_INTERNAL_Automaton *a; |
2545 | struct REGEX_ITERNAL_Automaton *b; | 2545 | struct REGEX_INTERNAL_Automaton *b; |
2546 | struct REGEX_ITERNAL_Automaton *new_nfa; | 2546 | struct REGEX_INTERNAL_Automaton *new_nfa; |
2547 | 2547 | ||
2548 | b = ctx->stack_tail; | 2548 | b = ctx->stack_tail; |
2549 | GNUNET_assert (NULL != b); | 2549 | GNUNET_assert (NULL != b); |
@@ -2575,12 +2575,12 @@ nfa_add_concatenation (struct REGEX_ITERNAL_Context *ctx) | |||
2575 | * @param ctx context | 2575 | * @param ctx context |
2576 | */ | 2576 | */ |
2577 | static void | 2577 | static void |
2578 | nfa_add_star_op (struct REGEX_ITERNAL_Context *ctx) | 2578 | nfa_add_star_op (struct REGEX_INTERNAL_Context *ctx) |
2579 | { | 2579 | { |
2580 | struct REGEX_ITERNAL_Automaton *a; | 2580 | struct REGEX_INTERNAL_Automaton *a; |
2581 | struct REGEX_ITERNAL_Automaton *new_nfa; | 2581 | struct REGEX_INTERNAL_Automaton *new_nfa; |
2582 | struct REGEX_ITERNAL_State *start; | 2582 | struct REGEX_INTERNAL_State *start; |
2583 | struct REGEX_ITERNAL_State *end; | 2583 | struct REGEX_INTERNAL_State *end; |
2584 | 2584 | ||
2585 | a = ctx->stack_tail; | 2585 | a = ctx->stack_tail; |
2586 | 2586 | ||
@@ -2618,9 +2618,9 @@ nfa_add_star_op (struct REGEX_ITERNAL_Context *ctx) | |||
2618 | * @param ctx context | 2618 | * @param ctx context |
2619 | */ | 2619 | */ |
2620 | static void | 2620 | static void |
2621 | nfa_add_plus_op (struct REGEX_ITERNAL_Context *ctx) | 2621 | nfa_add_plus_op (struct REGEX_INTERNAL_Context *ctx) |
2622 | { | 2622 | { |
2623 | struct REGEX_ITERNAL_Automaton *a; | 2623 | struct REGEX_INTERNAL_Automaton *a; |
2624 | 2624 | ||
2625 | a = ctx->stack_tail; | 2625 | a = ctx->stack_tail; |
2626 | 2626 | ||
@@ -2645,12 +2645,12 @@ nfa_add_plus_op (struct REGEX_ITERNAL_Context *ctx) | |||
2645 | * @param ctx context | 2645 | * @param ctx context |
2646 | */ | 2646 | */ |
2647 | static void | 2647 | static void |
2648 | nfa_add_question_op (struct REGEX_ITERNAL_Context *ctx) | 2648 | nfa_add_question_op (struct REGEX_INTERNAL_Context *ctx) |
2649 | { | 2649 | { |
2650 | struct REGEX_ITERNAL_Automaton *a; | 2650 | struct REGEX_INTERNAL_Automaton *a; |
2651 | struct REGEX_ITERNAL_Automaton *new_nfa; | 2651 | struct REGEX_INTERNAL_Automaton *new_nfa; |
2652 | struct REGEX_ITERNAL_State *start; | 2652 | struct REGEX_INTERNAL_State *start; |
2653 | struct REGEX_ITERNAL_State *end; | 2653 | struct REGEX_INTERNAL_State *end; |
2654 | 2654 | ||
2655 | a = ctx->stack_tail; | 2655 | a = ctx->stack_tail; |
2656 | 2656 | ||
@@ -2686,13 +2686,13 @@ nfa_add_question_op (struct REGEX_ITERNAL_Context *ctx) | |||
2686 | * @param ctx context | 2686 | * @param ctx context |
2687 | */ | 2687 | */ |
2688 | static void | 2688 | static void |
2689 | nfa_add_alternation (struct REGEX_ITERNAL_Context *ctx) | 2689 | nfa_add_alternation (struct REGEX_INTERNAL_Context *ctx) |
2690 | { | 2690 | { |
2691 | struct REGEX_ITERNAL_Automaton *a; | 2691 | struct REGEX_INTERNAL_Automaton *a; |
2692 | struct REGEX_ITERNAL_Automaton *b; | 2692 | struct REGEX_INTERNAL_Automaton *b; |
2693 | struct REGEX_ITERNAL_Automaton *new_nfa; | 2693 | struct REGEX_INTERNAL_Automaton *new_nfa; |
2694 | struct REGEX_ITERNAL_State *start; | 2694 | struct REGEX_INTERNAL_State *start; |
2695 | struct REGEX_ITERNAL_State *end; | 2695 | struct REGEX_INTERNAL_State *end; |
2696 | 2696 | ||
2697 | b = ctx->stack_tail; | 2697 | b = ctx->stack_tail; |
2698 | GNUNET_assert (NULL != b); | 2698 | GNUNET_assert (NULL != b); |
@@ -2730,11 +2730,11 @@ nfa_add_alternation (struct REGEX_ITERNAL_Context *ctx) | |||
2730 | * @param label label for nfa transition | 2730 | * @param label label for nfa transition |
2731 | */ | 2731 | */ |
2732 | static void | 2732 | static void |
2733 | nfa_add_label (struct REGEX_ITERNAL_Context *ctx, const char *label) | 2733 | nfa_add_label (struct REGEX_INTERNAL_Context *ctx, const char *label) |
2734 | { | 2734 | { |
2735 | struct REGEX_ITERNAL_Automaton *n; | 2735 | struct REGEX_INTERNAL_Automaton *n; |
2736 | struct REGEX_ITERNAL_State *start; | 2736 | struct REGEX_INTERNAL_State *start; |
2737 | struct REGEX_ITERNAL_State *end; | 2737 | struct REGEX_INTERNAL_State *end; |
2738 | 2738 | ||
2739 | GNUNET_assert (NULL != ctx); | 2739 | GNUNET_assert (NULL != ctx); |
2740 | 2740 | ||
@@ -2753,7 +2753,7 @@ nfa_add_label (struct REGEX_ITERNAL_Context *ctx, const char *label) | |||
2753 | * @param ctx context | 2753 | * @param ctx context |
2754 | */ | 2754 | */ |
2755 | static void | 2755 | static void |
2756 | REGEX_ITERNAL_context_init (struct REGEX_ITERNAL_Context *ctx) | 2756 | REGEX_INTERNAL_context_init (struct REGEX_INTERNAL_Context *ctx) |
2757 | { | 2757 | { |
2758 | if (NULL == ctx) | 2758 | if (NULL == ctx) |
2759 | { | 2759 | { |
@@ -2773,13 +2773,13 @@ REGEX_ITERNAL_context_init (struct REGEX_ITERNAL_Context *ctx) | |||
2773 | * @param regex regular expression string | 2773 | * @param regex regular expression string |
2774 | * @param len length of the string | 2774 | * @param len length of the string |
2775 | * | 2775 | * |
2776 | * @return NFA, needs to be freed using REGEX_ITERNAL_destroy_automaton | 2776 | * @return NFA, needs to be freed using REGEX_INTERNAL_destroy_automaton |
2777 | */ | 2777 | */ |
2778 | struct REGEX_ITERNAL_Automaton * | 2778 | struct REGEX_INTERNAL_Automaton * |
2779 | REGEX_ITERNAL_construct_nfa (const char *regex, const size_t len) | 2779 | REGEX_INTERNAL_construct_nfa (const char *regex, const size_t len) |
2780 | { | 2780 | { |
2781 | struct REGEX_ITERNAL_Context ctx; | 2781 | struct REGEX_INTERNAL_Context ctx; |
2782 | struct REGEX_ITERNAL_Automaton *nfa; | 2782 | struct REGEX_INTERNAL_Automaton *nfa; |
2783 | const char *regexp; | 2783 | const char *regexp; |
2784 | char curlabel[2]; | 2784 | char curlabel[2]; |
2785 | char *error_msg; | 2785 | char *error_msg; |
@@ -2801,7 +2801,7 @@ REGEX_ITERNAL_construct_nfa (const char *regex, const size_t len) | |||
2801 | 2801 | ||
2802 | return NULL; | 2802 | return NULL; |
2803 | } | 2803 | } |
2804 | REGEX_ITERNAL_context_init (&ctx); | 2804 | REGEX_INTERNAL_context_init (&ctx); |
2805 | 2805 | ||
2806 | regexp = regex; | 2806 | regexp = regex; |
2807 | curlabel[1] = '\0'; | 2807 | curlabel[1] = '\0'; |
@@ -2924,7 +2924,7 @@ REGEX_ITERNAL_construct_nfa (const char *regex, const size_t len) | |||
2924 | nfa->regex = GNUNET_strdup (regex); | 2924 | nfa->regex = GNUNET_strdup (regex); |
2925 | 2925 | ||
2926 | /* create depth-first numbering of the states for pretty printing */ | 2926 | /* create depth-first numbering of the states for pretty printing */ |
2927 | REGEX_ITERNAL_automaton_traverse (nfa, NULL, NULL, NULL, &number_states, NULL); | 2927 | REGEX_INTERNAL_automaton_traverse (nfa, NULL, NULL, NULL, &number_states, NULL); |
2928 | 2928 | ||
2929 | /* No multistriding added so far */ | 2929 | /* No multistriding added so far */ |
2930 | nfa->is_multistrided = GNUNET_NO; | 2930 | nfa->is_multistrided = GNUNET_NO; |
@@ -2941,7 +2941,7 @@ error: | |||
2941 | while (NULL != (nfa = ctx.stack_head)) | 2941 | while (NULL != (nfa = ctx.stack_head)) |
2942 | { | 2942 | { |
2943 | GNUNET_CONTAINER_DLL_remove (ctx.stack_head, ctx.stack_tail, nfa); | 2943 | GNUNET_CONTAINER_DLL_remove (ctx.stack_head, ctx.stack_tail, nfa); |
2944 | REGEX_ITERNAL_automaton_destroy (nfa); | 2944 | REGEX_INTERNAL_automaton_destroy (nfa); |
2945 | } | 2945 | } |
2946 | 2946 | ||
2947 | return NULL; | 2947 | return NULL; |
@@ -2958,17 +2958,17 @@ error: | |||
2958 | * for starting. | 2958 | * for starting. |
2959 | */ | 2959 | */ |
2960 | static void | 2960 | static void |
2961 | construct_dfa_states (struct REGEX_ITERNAL_Context *ctx, | 2961 | construct_dfa_states (struct REGEX_INTERNAL_Context *ctx, |
2962 | struct REGEX_ITERNAL_Automaton *nfa, | 2962 | struct REGEX_INTERNAL_Automaton *nfa, |
2963 | struct REGEX_ITERNAL_Automaton *dfa, | 2963 | struct REGEX_INTERNAL_Automaton *dfa, |
2964 | struct REGEX_ITERNAL_State *dfa_state) | 2964 | struct REGEX_INTERNAL_State *dfa_state) |
2965 | { | 2965 | { |
2966 | struct REGEX_ITERNAL_Transition *ctran; | 2966 | struct REGEX_INTERNAL_Transition *ctran; |
2967 | struct REGEX_ITERNAL_State *new_dfa_state; | 2967 | struct REGEX_INTERNAL_State *new_dfa_state; |
2968 | struct REGEX_ITERNAL_State *state_contains; | 2968 | struct REGEX_INTERNAL_State *state_contains; |
2969 | struct REGEX_ITERNAL_State *state_iter; | 2969 | struct REGEX_INTERNAL_State *state_iter; |
2970 | struct REGEX_ITERNAL_StateSet tmp; | 2970 | struct REGEX_INTERNAL_StateSet tmp; |
2971 | struct REGEX_ITERNAL_StateSet nfa_set; | 2971 | struct REGEX_INTERNAL_StateSet nfa_set; |
2972 | 2972 | ||
2973 | for (ctran = dfa_state->transitions_head; NULL != ctran; ctran = ctran->next) | 2973 | for (ctran = dfa_state->transitions_head; NULL != ctran; ctran = ctran->next) |
2974 | { | 2974 | { |
@@ -3020,23 +3020,23 @@ construct_dfa_states (struct REGEX_ITERNAL_Context *ctx, | |||
3020 | * @param max_path_len limit the path compression length to the | 3020 | * @param max_path_len limit the path compression length to the |
3021 | * given value. If set to 1, no path compression is applied. Set to 0 for | 3021 | * given value. If set to 1, no path compression is applied. Set to 0 for |
3022 | * maximal possible path compression (generally not desireable). | 3022 | * maximal possible path compression (generally not desireable). |
3023 | * @return DFA, needs to be freed using REGEX_ITERNAL_automaton_destroy. | 3023 | * @return DFA, needs to be freed using REGEX_INTERNAL_automaton_destroy. |
3024 | */ | 3024 | */ |
3025 | struct REGEX_ITERNAL_Automaton * | 3025 | struct REGEX_INTERNAL_Automaton * |
3026 | REGEX_ITERNAL_construct_dfa (const char *regex, const size_t len, | 3026 | REGEX_INTERNAL_construct_dfa (const char *regex, const size_t len, |
3027 | unsigned int max_path_len) | 3027 | unsigned int max_path_len) |
3028 | { | 3028 | { |
3029 | struct REGEX_ITERNAL_Context ctx; | 3029 | struct REGEX_INTERNAL_Context ctx; |
3030 | struct REGEX_ITERNAL_Automaton *dfa; | 3030 | struct REGEX_INTERNAL_Automaton *dfa; |
3031 | struct REGEX_ITERNAL_Automaton *nfa; | 3031 | struct REGEX_INTERNAL_Automaton *nfa; |
3032 | struct REGEX_ITERNAL_StateSet nfa_start_eps_cls; | 3032 | struct REGEX_INTERNAL_StateSet nfa_start_eps_cls; |
3033 | struct REGEX_ITERNAL_StateSet singleton_set; | 3033 | struct REGEX_INTERNAL_StateSet singleton_set; |
3034 | 3034 | ||
3035 | REGEX_ITERNAL_context_init (&ctx); | 3035 | REGEX_INTERNAL_context_init (&ctx); |
3036 | 3036 | ||
3037 | /* Create NFA */ | 3037 | /* Create NFA */ |
3038 | // fprintf (stderr, "N"); | 3038 | // fprintf (stderr, "N"); |
3039 | nfa = REGEX_ITERNAL_construct_nfa (regex, len); | 3039 | nfa = REGEX_INTERNAL_construct_nfa (regex, len); |
3040 | 3040 | ||
3041 | if (NULL == nfa) | 3041 | if (NULL == nfa) |
3042 | { | 3042 | { |
@@ -3045,12 +3045,12 @@ REGEX_ITERNAL_construct_dfa (const char *regex, const size_t len, | |||
3045 | return NULL; | 3045 | return NULL; |
3046 | } | 3046 | } |
3047 | 3047 | ||
3048 | dfa = GNUNET_malloc (sizeof (struct REGEX_ITERNAL_Automaton)); | 3048 | dfa = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Automaton)); |
3049 | dfa->type = DFA; | 3049 | dfa->type = DFA; |
3050 | dfa->regex = GNUNET_strdup (regex); | 3050 | dfa->regex = GNUNET_strdup (regex); |
3051 | 3051 | ||
3052 | /* Create DFA start state from epsilon closure */ | 3052 | /* Create DFA start state from epsilon closure */ |
3053 | memset (&singleton_set, 0, sizeof (struct REGEX_ITERNAL_StateSet)); | 3053 | memset (&singleton_set, 0, sizeof (struct REGEX_INTERNAL_StateSet)); |
3054 | state_set_append (&singleton_set, nfa->start); | 3054 | state_set_append (&singleton_set, nfa->start); |
3055 | nfa_closure_set_create (&nfa_start_eps_cls, nfa, &singleton_set, NULL); | 3055 | nfa_closure_set_create (&nfa_start_eps_cls, nfa, &singleton_set, NULL); |
3056 | state_set_clear (&singleton_set); | 3056 | state_set_clear (&singleton_set); |
@@ -3059,20 +3059,20 @@ REGEX_ITERNAL_construct_dfa (const char *regex, const size_t len, | |||
3059 | 3059 | ||
3060 | // fprintf (stderr, "D"); | 3060 | // fprintf (stderr, "D"); |
3061 | construct_dfa_states (&ctx, nfa, dfa, dfa->start); | 3061 | construct_dfa_states (&ctx, nfa, dfa, dfa->start); |
3062 | REGEX_ITERNAL_automaton_destroy (nfa); | 3062 | REGEX_INTERNAL_automaton_destroy (nfa); |
3063 | 3063 | ||
3064 | /* Minimize DFA */ | 3064 | /* Minimize DFA */ |
3065 | // fprintf (stderr, "M"); | 3065 | // fprintf (stderr, "M"); |
3066 | if (GNUNET_OK != dfa_minimize (&ctx, dfa)) | 3066 | if (GNUNET_OK != dfa_minimize (&ctx, dfa)) |
3067 | { | 3067 | { |
3068 | REGEX_ITERNAL_automaton_destroy (dfa); | 3068 | REGEX_INTERNAL_automaton_destroy (dfa); |
3069 | return NULL; | 3069 | return NULL; |
3070 | } | 3070 | } |
3071 | 3071 | ||
3072 | /* Create proofs and hashes for all states */ | 3072 | /* Create proofs and hashes for all states */ |
3073 | if (GNUNET_OK != automaton_create_proofs (dfa)) | 3073 | if (GNUNET_OK != automaton_create_proofs (dfa)) |
3074 | { | 3074 | { |
3075 | REGEX_ITERNAL_automaton_destroy (dfa); | 3075 | REGEX_INTERNAL_automaton_destroy (dfa); |
3076 | return NULL; | 3076 | return NULL; |
3077 | } | 3077 | } |
3078 | 3078 | ||
@@ -3085,16 +3085,16 @@ REGEX_ITERNAL_construct_dfa (const char *regex, const size_t len, | |||
3085 | 3085 | ||
3086 | 3086 | ||
3087 | /** | 3087 | /** |
3088 | * Free the memory allocated by constructing the REGEX_ITERNAL_Automaton data | 3088 | * Free the memory allocated by constructing the REGEX_INTERNAL_Automaton data |
3089 | * structure. | 3089 | * structure. |
3090 | * | 3090 | * |
3091 | * @param a automaton to be destroyed | 3091 | * @param a automaton to be destroyed |
3092 | */ | 3092 | */ |
3093 | void | 3093 | void |
3094 | REGEX_ITERNAL_automaton_destroy (struct REGEX_ITERNAL_Automaton *a) | 3094 | REGEX_INTERNAL_automaton_destroy (struct REGEX_INTERNAL_Automaton *a) |
3095 | { | 3095 | { |
3096 | struct REGEX_ITERNAL_State *s; | 3096 | struct REGEX_INTERNAL_State *s; |
3097 | struct REGEX_ITERNAL_State *next_state; | 3097 | struct REGEX_INTERNAL_State *next_state; |
3098 | 3098 | ||
3099 | if (NULL == a) | 3099 | if (NULL == a) |
3100 | return; | 3100 | return; |
@@ -3122,10 +3122,10 @@ REGEX_ITERNAL_automaton_destroy (struct REGEX_ITERNAL_Automaton *a) | |||
3122 | * @return 0 if string matches, non 0 otherwise | 3122 | * @return 0 if string matches, non 0 otherwise |
3123 | */ | 3123 | */ |
3124 | static int | 3124 | static int |
3125 | evaluate_dfa (struct REGEX_ITERNAL_Automaton *a, const char *string) | 3125 | evaluate_dfa (struct REGEX_INTERNAL_Automaton *a, const char *string) |
3126 | { | 3126 | { |
3127 | const char *strp; | 3127 | const char *strp; |
3128 | struct REGEX_ITERNAL_State *s; | 3128 | struct REGEX_INTERNAL_State *s; |
3129 | unsigned int step_len; | 3129 | unsigned int step_len; |
3130 | 3130 | ||
3131 | if (DFA != a->type) | 3131 | if (DFA != a->type) |
@@ -3165,14 +3165,14 @@ evaluate_dfa (struct REGEX_ITERNAL_Automaton *a, const char *string) | |||
3165 | * @return 0 if string matches, non 0 otherwise | 3165 | * @return 0 if string matches, non 0 otherwise |
3166 | */ | 3166 | */ |
3167 | static int | 3167 | static int |
3168 | evaluate_nfa (struct REGEX_ITERNAL_Automaton *a, const char *string) | 3168 | evaluate_nfa (struct REGEX_INTERNAL_Automaton *a, const char *string) |
3169 | { | 3169 | { |
3170 | const char *strp; | 3170 | const char *strp; |
3171 | char str[2]; | 3171 | char str[2]; |
3172 | struct REGEX_ITERNAL_State *s; | 3172 | struct REGEX_INTERNAL_State *s; |
3173 | struct REGEX_ITERNAL_StateSet sset; | 3173 | struct REGEX_INTERNAL_StateSet sset; |
3174 | struct REGEX_ITERNAL_StateSet new_sset; | 3174 | struct REGEX_INTERNAL_StateSet new_sset; |
3175 | struct REGEX_ITERNAL_StateSet singleton_set; | 3175 | struct REGEX_INTERNAL_StateSet singleton_set; |
3176 | unsigned int i; | 3176 | unsigned int i; |
3177 | int result; | 3177 | int result; |
3178 | 3178 | ||
@@ -3188,7 +3188,7 @@ evaluate_nfa (struct REGEX_ITERNAL_Automaton *a, const char *string) | |||
3188 | return 0; | 3188 | return 0; |
3189 | 3189 | ||
3190 | result = 1; | 3190 | result = 1; |
3191 | memset (&singleton_set, 0, sizeof (struct REGEX_ITERNAL_StateSet)); | 3191 | memset (&singleton_set, 0, sizeof (struct REGEX_INTERNAL_StateSet)); |
3192 | state_set_append (&singleton_set, a->start); | 3192 | state_set_append (&singleton_set, a->start); |
3193 | nfa_closure_set_create (&sset, a, &singleton_set, NULL); | 3193 | nfa_closure_set_create (&sset, a, &singleton_set, NULL); |
3194 | state_set_clear (&singleton_set); | 3194 | state_set_clear (&singleton_set); |
@@ -3227,7 +3227,7 @@ evaluate_nfa (struct REGEX_ITERNAL_Automaton *a, const char *string) | |||
3227 | * @return 0 if string matches, non 0 otherwise | 3227 | * @return 0 if string matches, non 0 otherwise |
3228 | */ | 3228 | */ |
3229 | int | 3229 | int |
3230 | REGEX_ITERNAL_eval (struct REGEX_ITERNAL_Automaton *a, const char *string) | 3230 | REGEX_INTERNAL_eval (struct REGEX_INTERNAL_Automaton *a, const char *string) |
3231 | { | 3231 | { |
3232 | int result; | 3232 | int result; |
3233 | 3233 | ||
@@ -3262,7 +3262,7 @@ REGEX_ITERNAL_eval (struct REGEX_ITERNAL_Automaton *a, const char *string) | |||
3262 | * @return | 3262 | * @return |
3263 | */ | 3263 | */ |
3264 | const char * | 3264 | const char * |
3265 | REGEX_ITERNAL_get_canonical_regex (struct REGEX_ITERNAL_Automaton *a) | 3265 | REGEX_INTERNAL_get_canonical_regex (struct REGEX_INTERNAL_Automaton *a) |
3266 | { | 3266 | { |
3267 | if (NULL == a) | 3267 | if (NULL == a) |
3268 | return NULL; | 3268 | return NULL; |
@@ -3279,10 +3279,10 @@ REGEX_ITERNAL_get_canonical_regex (struct REGEX_ITERNAL_Automaton *a) | |||
3279 | * @return number of transitions in the given automaton. | 3279 | * @return number of transitions in the given automaton. |
3280 | */ | 3280 | */ |
3281 | unsigned int | 3281 | unsigned int |
3282 | REGEX_ITERNAL_get_transition_count (struct REGEX_ITERNAL_Automaton *a) | 3282 | REGEX_INTERNAL_get_transition_count (struct REGEX_INTERNAL_Automaton *a) |
3283 | { | 3283 | { |
3284 | unsigned int t_count; | 3284 | unsigned int t_count; |
3285 | struct REGEX_ITERNAL_State *s; | 3285 | struct REGEX_INTERNAL_State *s; |
3286 | 3286 | ||
3287 | if (NULL == a) | 3287 | if (NULL == a) |
3288 | return 0; | 3288 | return 0; |
@@ -3307,7 +3307,7 @@ REGEX_ITERNAL_get_transition_count (struct REGEX_ITERNAL_Automaton *a) | |||
3307 | * to construct the key | 3307 | * to construct the key |
3308 | */ | 3308 | */ |
3309 | size_t | 3309 | size_t |
3310 | REGEX_ITERNAL_get_first_key (const char *input_string, size_t string_len, | 3310 | REGEX_INTERNAL_get_first_key (const char *input_string, size_t string_len, |
3311 | struct GNUNET_HashCode * key) | 3311 | struct GNUNET_HashCode * key) |
3312 | { | 3312 | { |
3313 | unsigned int size; | 3313 | unsigned int size; |
@@ -3337,7 +3337,7 @@ REGEX_ITERNAL_get_first_key (const char *input_string, size_t string_len, | |||
3337 | * @return GNUNET_OK if the proof is valid for the given key. | 3337 | * @return GNUNET_OK if the proof is valid for the given key. |
3338 | */ | 3338 | */ |
3339 | int | 3339 | int |
3340 | REGEX_ITERNAL_check_proof (const char *proof, const struct GNUNET_HashCode *key) | 3340 | REGEX_INTERNAL_check_proof (const char *proof, const struct GNUNET_HashCode *key) |
3341 | { | 3341 | { |
3342 | struct GNUNET_HashCode key_check; | 3342 | struct GNUNET_HashCode key_check; |
3343 | 3343 | ||
@@ -3365,15 +3365,15 @@ REGEX_ITERNAL_check_proof (const char *proof, const struct GNUNET_HashCode *key) | |||
3365 | */ | 3365 | */ |
3366 | static void | 3366 | static void |
3367 | iterate_initial_edge (const unsigned int min_len, const unsigned int max_len, | 3367 | iterate_initial_edge (const unsigned int min_len, const unsigned int max_len, |
3368 | char *consumed_string, struct REGEX_ITERNAL_State *state, | 3368 | char *consumed_string, struct REGEX_INTERNAL_State *state, |
3369 | REGEX_ITERNAL_KeyIterator iterator, void *iterator_cls) | 3369 | REGEX_INTERNAL_KeyIterator iterator, void *iterator_cls) |
3370 | { | 3370 | { |
3371 | unsigned int i; | 3371 | unsigned int i; |
3372 | char *temp; | 3372 | char *temp; |
3373 | struct REGEX_ITERNAL_Transition *t; | 3373 | struct REGEX_INTERNAL_Transition *t; |
3374 | unsigned int num_edges = state->transition_count; | 3374 | unsigned int num_edges = state->transition_count; |
3375 | struct REGEX_ITERNAL_Edge edges[num_edges]; | 3375 | struct REGEX_INTERNAL_Edge edges[num_edges]; |
3376 | struct REGEX_ITERNAL_Edge edge[1]; | 3376 | struct REGEX_INTERNAL_Edge edge[1]; |
3377 | struct GNUNET_HashCode hash; | 3377 | struct GNUNET_HashCode hash; |
3378 | struct GNUNET_HashCode hash_new; | 3378 | struct GNUNET_HashCode hash_new; |
3379 | 3379 | ||
@@ -3455,15 +3455,15 @@ iterate_initial_edge (const unsigned int min_len, const unsigned int max_len, | |||
3455 | * @param iterator_cls closure. | 3455 | * @param iterator_cls closure. |
3456 | */ | 3456 | */ |
3457 | void | 3457 | void |
3458 | REGEX_ITERNAL_iterate_all_edges (struct REGEX_ITERNAL_Automaton *a, | 3458 | REGEX_INTERNAL_iterate_all_edges (struct REGEX_INTERNAL_Automaton *a, |
3459 | REGEX_ITERNAL_KeyIterator iterator, | 3459 | REGEX_INTERNAL_KeyIterator iterator, |
3460 | void *iterator_cls) | 3460 | void *iterator_cls) |
3461 | { | 3461 | { |
3462 | struct REGEX_ITERNAL_State *s; | 3462 | struct REGEX_INTERNAL_State *s; |
3463 | 3463 | ||
3464 | for (s = a->states_head; NULL != s; s = s->next) | 3464 | for (s = a->states_head; NULL != s; s = s->next) |
3465 | { | 3465 | { |
3466 | struct REGEX_ITERNAL_Edge edges[s->transition_count]; | 3466 | struct REGEX_INTERNAL_Edge edges[s->transition_count]; |
3467 | unsigned int num_edges; | 3467 | unsigned int num_edges; |
3468 | 3468 | ||
3469 | num_edges = state_get_edges (s, edges); | 3469 | num_edges = state_get_edges (s, edges); |
diff --git a/src/regex/regex_internal.h b/src/regex/regex_internal.h index cd76c1c73..69a8971d5 100644 --- a/src/regex/regex_internal.h +++ b/src/regex/regex_internal.h | |||
@@ -47,17 +47,17 @@ extern "C" | |||
47 | * which they origin ('from_state'). Each state can have 0-n transitions. | 47 | * which they origin ('from_state'). Each state can have 0-n transitions. |
48 | * If label is NULL, this is considered to be an epsilon transition. | 48 | * If label is NULL, this is considered to be an epsilon transition. |
49 | */ | 49 | */ |
50 | struct REGEX_ITERNAL_Transition | 50 | struct REGEX_INTERNAL_Transition |
51 | { | 51 | { |
52 | /** | 52 | /** |
53 | * This is a linked list. | 53 | * This is a linked list. |
54 | */ | 54 | */ |
55 | struct REGEX_ITERNAL_Transition *prev; | 55 | struct REGEX_INTERNAL_Transition *prev; |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * This is a linked list. | 58 | * This is a linked list. |
59 | */ | 59 | */ |
60 | struct REGEX_ITERNAL_Transition *next; | 60 | struct REGEX_INTERNAL_Transition *next; |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Unique id of this transition. | 63 | * Unique id of this transition. |
@@ -72,30 +72,30 @@ struct REGEX_ITERNAL_Transition | |||
72 | /** | 72 | /** |
73 | * State to which this transition leads. | 73 | * State to which this transition leads. |
74 | */ | 74 | */ |
75 | struct REGEX_ITERNAL_State *to_state; | 75 | struct REGEX_INTERNAL_State *to_state; |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * State from which this transition origins. | 78 | * State from which this transition origins. |
79 | */ | 79 | */ |
80 | struct REGEX_ITERNAL_State *from_state; | 80 | struct REGEX_INTERNAL_State *from_state; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | 83 | ||
84 | /** | 84 | /** |
85 | * A state. Can be used in DFA and NFA automatons. | 85 | * A state. Can be used in DFA and NFA automatons. |
86 | */ | 86 | */ |
87 | struct REGEX_ITERNAL_State; | 87 | struct REGEX_INTERNAL_State; |
88 | 88 | ||
89 | 89 | ||
90 | /** | 90 | /** |
91 | * Set of states. | 91 | * Set of states. |
92 | */ | 92 | */ |
93 | struct REGEX_ITERNAL_StateSet | 93 | struct REGEX_INTERNAL_StateSet |
94 | { | 94 | { |
95 | /** | 95 | /** |
96 | * Array of states. | 96 | * Array of states. |
97 | */ | 97 | */ |
98 | struct REGEX_ITERNAL_State **states; | 98 | struct REGEX_INTERNAL_State **states; |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * Number of entries in *use* in the 'states' array. | 101 | * Number of entries in *use* in the 'states' array. |
@@ -112,37 +112,37 @@ struct REGEX_ITERNAL_StateSet | |||
112 | /** | 112 | /** |
113 | * A state. Can be used in DFA and NFA automatons. | 113 | * A state. Can be used in DFA and NFA automatons. |
114 | */ | 114 | */ |
115 | struct REGEX_ITERNAL_State | 115 | struct REGEX_INTERNAL_State |
116 | { | 116 | { |
117 | /** | 117 | /** |
118 | * This is a linked list to keep states in an automaton. | 118 | * This is a linked list to keep states in an automaton. |
119 | */ | 119 | */ |
120 | struct REGEX_ITERNAL_State *prev; | 120 | struct REGEX_INTERNAL_State *prev; |
121 | 121 | ||
122 | /** | 122 | /** |
123 | * This is a linked list to keep states in an automaton. | 123 | * This is a linked list to keep states in an automaton. |
124 | */ | 124 | */ |
125 | struct REGEX_ITERNAL_State *next; | 125 | struct REGEX_INTERNAL_State *next; |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * This is a multi DLL for StateSet_MDLL. | 128 | * This is a multi DLL for StateSet_MDLL. |
129 | */ | 129 | */ |
130 | struct REGEX_ITERNAL_State *prev_SS; | 130 | struct REGEX_INTERNAL_State *prev_SS; |
131 | 131 | ||
132 | /** | 132 | /** |
133 | * This is a multi DLL for StateSet_MDLL. | 133 | * This is a multi DLL for StateSet_MDLL. |
134 | */ | 134 | */ |
135 | struct REGEX_ITERNAL_State *next_SS; | 135 | struct REGEX_INTERNAL_State *next_SS; |
136 | 136 | ||
137 | /** | 137 | /** |
138 | * This is a multi DLL for StateSet_MDLL Stack. | 138 | * This is a multi DLL for StateSet_MDLL Stack. |
139 | */ | 139 | */ |
140 | struct REGEX_ITERNAL_State *prev_ST; | 140 | struct REGEX_INTERNAL_State *prev_ST; |
141 | 141 | ||
142 | /** | 142 | /** |
143 | * This is a multi DLL for StateSet_MDLL Stack. | 143 | * This is a multi DLL for StateSet_MDLL Stack. |
144 | */ | 144 | */ |
145 | struct REGEX_ITERNAL_State *next_ST; | 145 | struct REGEX_INTERNAL_State *next_ST; |
146 | 146 | ||
147 | /** | 147 | /** |
148 | * Unique state id. | 148 | * Unique state id. |
@@ -222,12 +222,12 @@ struct REGEX_ITERNAL_State | |||
222 | /** | 222 | /** |
223 | * DLL of transitions. | 223 | * DLL of transitions. |
224 | */ | 224 | */ |
225 | struct REGEX_ITERNAL_Transition *transitions_head; | 225 | struct REGEX_INTERNAL_Transition *transitions_head; |
226 | 226 | ||
227 | /** | 227 | /** |
228 | * DLL of transitions. | 228 | * DLL of transitions. |
229 | */ | 229 | */ |
230 | struct REGEX_ITERNAL_Transition *transitions_tail; | 230 | struct REGEX_INTERNAL_Transition *transitions_tail; |
231 | 231 | ||
232 | /** | 232 | /** |
233 | * Number of incoming transitions. Used for compressing DFA paths. | 233 | * Number of incoming transitions. Used for compressing DFA paths. |
@@ -238,14 +238,14 @@ struct REGEX_ITERNAL_State | |||
238 | * Set of states on which this state is based on. Used when creating a DFA out | 238 | * Set of states on which this state is based on. Used when creating a DFA out |
239 | * of several NFA states. | 239 | * of several NFA states. |
240 | */ | 240 | */ |
241 | struct REGEX_ITERNAL_StateSet nfa_set; | 241 | struct REGEX_INTERNAL_StateSet nfa_set; |
242 | }; | 242 | }; |
243 | 243 | ||
244 | 244 | ||
245 | /** | 245 | /** |
246 | * Type of an automaton. | 246 | * Type of an automaton. |
247 | */ | 247 | */ |
248 | enum REGEX_ITERNAL_AutomatonType | 248 | enum REGEX_INTERNAL_AutomatonType |
249 | { | 249 | { |
250 | NFA, | 250 | NFA, |
251 | DFA | 251 | DFA |
@@ -255,28 +255,28 @@ enum REGEX_ITERNAL_AutomatonType | |||
255 | /** | 255 | /** |
256 | * Automaton representation. | 256 | * Automaton representation. |
257 | */ | 257 | */ |
258 | struct REGEX_ITERNAL_Automaton | 258 | struct REGEX_INTERNAL_Automaton |
259 | { | 259 | { |
260 | /** | 260 | /** |
261 | * Linked list of NFAs used for partial NFA creation. | 261 | * Linked list of NFAs used for partial NFA creation. |
262 | */ | 262 | */ |
263 | struct REGEX_ITERNAL_Automaton *prev; | 263 | struct REGEX_INTERNAL_Automaton *prev; |
264 | 264 | ||
265 | /** | 265 | /** |
266 | * Linked list of NFAs used for partial NFA creation. | 266 | * Linked list of NFAs used for partial NFA creation. |
267 | */ | 267 | */ |
268 | struct REGEX_ITERNAL_Automaton *next; | 268 | struct REGEX_INTERNAL_Automaton *next; |
269 | 269 | ||
270 | /** | 270 | /** |
271 | * First state of the automaton. This is mainly used for constructing an NFA, | 271 | * First state of the automaton. This is mainly used for constructing an NFA, |
272 | * where each NFA itself consists of one or more NFAs linked together. | 272 | * where each NFA itself consists of one or more NFAs linked together. |
273 | */ | 273 | */ |
274 | struct REGEX_ITERNAL_State *start; | 274 | struct REGEX_INTERNAL_State *start; |
275 | 275 | ||
276 | /** | 276 | /** |
277 | * End state of the partial NFA. This is undefined for DFAs | 277 | * End state of the partial NFA. This is undefined for DFAs |
278 | */ | 278 | */ |
279 | struct REGEX_ITERNAL_State *end; | 279 | struct REGEX_INTERNAL_State *end; |
280 | 280 | ||
281 | /** | 281 | /** |
282 | * Number of states in the automaton. | 282 | * Number of states in the automaton. |
@@ -286,17 +286,17 @@ struct REGEX_ITERNAL_Automaton | |||
286 | /** | 286 | /** |
287 | * DLL of states. | 287 | * DLL of states. |
288 | */ | 288 | */ |
289 | struct REGEX_ITERNAL_State *states_head; | 289 | struct REGEX_INTERNAL_State *states_head; |
290 | 290 | ||
291 | /** | 291 | /** |
292 | * DLL of states | 292 | * DLL of states |
293 | */ | 293 | */ |
294 | struct REGEX_ITERNAL_State *states_tail; | 294 | struct REGEX_INTERNAL_State *states_tail; |
295 | 295 | ||
296 | /** | 296 | /** |
297 | * Type of the automaton. | 297 | * Type of the automaton. |
298 | */ | 298 | */ |
299 | enum REGEX_ITERNAL_AutomatonType type; | 299 | enum REGEX_INTERNAL_AutomatonType type; |
300 | 300 | ||
301 | /** | 301 | /** |
302 | * Regex | 302 | * Regex |
@@ -321,10 +321,10 @@ struct REGEX_ITERNAL_Automaton | |||
321 | * @param regex regular expression string. | 321 | * @param regex regular expression string. |
322 | * @param len length of the string. | 322 | * @param len length of the string. |
323 | * | 323 | * |
324 | * @return NFA, needs to be freed using REGEX_ITERNAL_automaton_destroy. | 324 | * @return NFA, needs to be freed using REGEX_INTERNAL_automaton_destroy. |
325 | */ | 325 | */ |
326 | struct REGEX_ITERNAL_Automaton * | 326 | struct REGEX_INTERNAL_Automaton * |
327 | REGEX_ITERNAL_construct_nfa (const char *regex, const size_t len); | 327 | REGEX_INTERNAL_construct_nfa (const char *regex, const size_t len); |
328 | 328 | ||
329 | 329 | ||
330 | /** | 330 | /** |
@@ -339,9 +339,9 @@ REGEX_ITERNAL_construct_nfa (const char *regex, const size_t len); | |||
339 | * | 339 | * |
340 | * @return GNUNET_YES to proceed traversal, GNUNET_NO to stop. | 340 | * @return GNUNET_YES to proceed traversal, GNUNET_NO to stop. |
341 | */ | 341 | */ |
342 | typedef int (*REGEX_ITERNAL_traverse_check) (void *cls, | 342 | typedef int (*REGEX_INTERNAL_traverse_check) (void *cls, |
343 | struct REGEX_ITERNAL_State * s, | 343 | struct REGEX_INTERNAL_State * s, |
344 | struct REGEX_ITERNAL_Transition * t); | 344 | struct REGEX_INTERNAL_Transition * t); |
345 | 345 | ||
346 | 346 | ||
347 | /** | 347 | /** |
@@ -351,9 +351,9 @@ typedef int (*REGEX_ITERNAL_traverse_check) (void *cls, | |||
351 | * @param count current count of the state, from 0 to a->state_count -1. | 351 | * @param count current count of the state, from 0 to a->state_count -1. |
352 | * @param s state. | 352 | * @param s state. |
353 | */ | 353 | */ |
354 | typedef void (*REGEX_ITERNAL_traverse_action) (void *cls, | 354 | typedef void (*REGEX_INTERNAL_traverse_action) (void *cls, |
355 | const unsigned int count, | 355 | const unsigned int count, |
356 | struct REGEX_ITERNAL_State * s); | 356 | struct REGEX_INTERNAL_State * s); |
357 | 357 | ||
358 | 358 | ||
359 | /** | 359 | /** |
@@ -370,11 +370,11 @@ typedef void (*REGEX_ITERNAL_traverse_action) (void *cls, | |||
370 | * @param action_cls closure for action | 370 | * @param action_cls closure for action |
371 | */ | 371 | */ |
372 | void | 372 | void |
373 | REGEX_ITERNAL_automaton_traverse (const struct REGEX_ITERNAL_Automaton *a, | 373 | REGEX_INTERNAL_automaton_traverse (const struct REGEX_INTERNAL_Automaton *a, |
374 | struct REGEX_ITERNAL_State *start, | 374 | struct REGEX_INTERNAL_State *start, |
375 | REGEX_ITERNAL_traverse_check check, | 375 | REGEX_INTERNAL_traverse_check check, |
376 | void *check_cls, | 376 | void *check_cls, |
377 | REGEX_ITERNAL_traverse_action action, | 377 | REGEX_INTERNAL_traverse_action action, |
378 | void *action_cls); | 378 | void *action_cls); |
379 | 379 | ||
380 | /** | 380 | /** |
@@ -389,7 +389,7 @@ REGEX_ITERNAL_automaton_traverse (const struct REGEX_ITERNAL_Automaton *a, | |||
389 | * @return canonical regex string. | 389 | * @return canonical regex string. |
390 | */ | 390 | */ |
391 | const char * | 391 | const char * |
392 | REGEX_ITERNAL_get_canonical_regex (struct REGEX_ITERNAL_Automaton *a); | 392 | REGEX_INTERNAL_get_canonical_regex (struct REGEX_INTERNAL_Automaton *a); |
393 | 393 | ||
394 | 394 | ||
395 | /** | 395 | /** |
@@ -400,14 +400,14 @@ REGEX_ITERNAL_get_canonical_regex (struct REGEX_ITERNAL_Automaton *a); | |||
400 | * @return number of transitions in the given automaton. | 400 | * @return number of transitions in the given automaton. |
401 | */ | 401 | */ |
402 | unsigned int | 402 | unsigned int |
403 | REGEX_ITERNAL_get_transition_count (struct REGEX_ITERNAL_Automaton *a); | 403 | REGEX_INTERNAL_get_transition_count (struct REGEX_INTERNAL_Automaton *a); |
404 | 404 | ||
405 | 405 | ||
406 | /** | 406 | /** |
407 | * Context that contains an id counter for states and transitions as well as a | 407 | * Context that contains an id counter for states and transitions as well as a |
408 | * DLL of automatons used as a stack for NFA construction. | 408 | * DLL of automatons used as a stack for NFA construction. |
409 | */ | 409 | */ |
410 | struct REGEX_ITERNAL_Context | 410 | struct REGEX_INTERNAL_Context |
411 | { | 411 | { |
412 | /** | 412 | /** |
413 | * Unique state id. | 413 | * Unique state id. |
@@ -420,14 +420,14 @@ struct REGEX_ITERNAL_Context | |||
420 | unsigned int transition_id; | 420 | unsigned int transition_id; |
421 | 421 | ||
422 | /** | 422 | /** |
423 | * DLL of REGEX_ITERNAL_Automaton's used as a stack. | 423 | * DLL of REGEX_INTERNAL_Automaton's used as a stack. |
424 | */ | 424 | */ |
425 | struct REGEX_ITERNAL_Automaton *stack_head; | 425 | struct REGEX_INTERNAL_Automaton *stack_head; |
426 | 426 | ||
427 | /** | 427 | /** |
428 | * DLL of REGEX_ITERNAL_Automaton's used as a stack. | 428 | * DLL of REGEX_INTERNAL_Automaton's used as a stack. |
429 | */ | 429 | */ |
430 | struct REGEX_ITERNAL_Automaton *stack_tail; | 430 | struct REGEX_INTERNAL_Automaton *stack_tail; |
431 | }; | 431 | }; |
432 | 432 | ||
433 | 433 | ||
@@ -439,8 +439,8 @@ struct REGEX_ITERNAL_Context | |||
439 | * @param stride_len length of the strides. | 439 | * @param stride_len length of the strides. |
440 | */ | 440 | */ |
441 | void | 441 | void |
442 | REGEX_ITERNAL_dfa_add_multi_strides (struct REGEX_ITERNAL_Context *regex_ctx, | 442 | REGEX_INTERNAL_dfa_add_multi_strides (struct REGEX_INTERNAL_Context *regex_ctx, |
443 | struct REGEX_ITERNAL_Automaton *dfa, | 443 | struct REGEX_INTERNAL_Automaton *dfa, |
444 | const unsigned int stride_len); | 444 | const unsigned int stride_len); |
445 | 445 | ||
446 | 446 | ||
diff --git a/src/regex/regex_internal_dht.c b/src/regex/regex_internal_dht.c index 0b5d99928..a11d59752 100644 --- a/src/regex/regex_internal_dht.c +++ b/src/regex/regex_internal_dht.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #define DHT_OPT GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE | 42 | #define DHT_OPT GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | struct REGEX_ITERNAL_Announcement | 45 | struct REGEX_INTERNAL_Announcement |
46 | { | 46 | { |
47 | /** | 47 | /** |
48 | * DHT handle to use, must be initialized externally. | 48 | * DHT handle to use, must be initialized externally. |
@@ -57,7 +57,7 @@ struct REGEX_ITERNAL_Announcement | |||
57 | /** | 57 | /** |
58 | * Automaton representation of the regex (expensive to build). | 58 | * Automaton representation of the regex (expensive to build). |
59 | */ | 59 | */ |
60 | struct REGEX_ITERNAL_Automaton* dfa; | 60 | struct REGEX_INTERNAL_Automaton* dfa; |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Identity under which to announce the regex. | 63 | * Identity under which to announce the regex. |
@@ -87,9 +87,9 @@ regex_iterator (void *cls, | |||
87 | const char *proof, | 87 | const char *proof, |
88 | int accepting, | 88 | int accepting, |
89 | unsigned int num_edges, | 89 | unsigned int num_edges, |
90 | const struct REGEX_ITERNAL_Edge *edges) | 90 | const struct REGEX_INTERNAL_Edge *edges) |
91 | { | 91 | { |
92 | struct REGEX_ITERNAL_Announcement *h = cls; | 92 | struct REGEX_INTERNAL_Announcement *h = cls; |
93 | struct RegexBlock *block; | 93 | struct RegexBlock *block; |
94 | struct RegexEdge *block_edge; | 94 | struct RegexEdge *block_edge; |
95 | size_t size; | 95 | size_t size; |
@@ -182,43 +182,43 @@ regex_iterator (void *cls, | |||
182 | } | 182 | } |
183 | 183 | ||
184 | 184 | ||
185 | struct REGEX_ITERNAL_Announcement * | 185 | struct REGEX_INTERNAL_Announcement * |
186 | REGEX_ITERNAL_announce (struct GNUNET_DHT_Handle *dht, | 186 | REGEX_INTERNAL_announce (struct GNUNET_DHT_Handle *dht, |
187 | const struct GNUNET_PeerIdentity *id, | 187 | const struct GNUNET_PeerIdentity *id, |
188 | const char *regex, | 188 | const char *regex, |
189 | uint16_t compression, | 189 | uint16_t compression, |
190 | struct GNUNET_STATISTICS_Handle *stats) | 190 | struct GNUNET_STATISTICS_Handle *stats) |
191 | { | 191 | { |
192 | struct REGEX_ITERNAL_Announcement *h; | 192 | struct REGEX_INTERNAL_Announcement *h; |
193 | 193 | ||
194 | GNUNET_assert (NULL != dht); | 194 | GNUNET_assert (NULL != dht); |
195 | h = GNUNET_malloc (sizeof (struct REGEX_ITERNAL_Announcement)); | 195 | h = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Announcement)); |
196 | h->regex = regex; | 196 | h->regex = regex; |
197 | h->dht = dht; | 197 | h->dht = dht; |
198 | h->stats = stats; | 198 | h->stats = stats; |
199 | h->id = *id; | 199 | h->id = *id; |
200 | h->dfa = REGEX_ITERNAL_construct_dfa (regex, | 200 | h->dfa = REGEX_INTERNAL_construct_dfa (regex, |
201 | strlen (regex), | 201 | strlen (regex), |
202 | compression); | 202 | compression); |
203 | REGEX_ITERNAL_reannounce (h); | 203 | REGEX_INTERNAL_reannounce (h); |
204 | return h; | 204 | return h; |
205 | } | 205 | } |
206 | 206 | ||
207 | 207 | ||
208 | void | 208 | void |
209 | REGEX_ITERNAL_reannounce (struct REGEX_ITERNAL_Announcement *h) | 209 | REGEX_INTERNAL_reannounce (struct REGEX_INTERNAL_Announcement *h) |
210 | { | 210 | { |
211 | GNUNET_assert (NULL != h->dfa); /* make sure to call announce first */ | 211 | GNUNET_assert (NULL != h->dfa); /* make sure to call announce first */ |
212 | LOG (GNUNET_ERROR_TYPE_INFO, "REGEX_ITERNAL_reannounce: %.60s\n", h->regex); | 212 | LOG (GNUNET_ERROR_TYPE_INFO, "REGEX_INTERNAL_reannounce: %.60s\n", h->regex); |
213 | LOG (GNUNET_ERROR_TYPE_DEBUG, " full: %s\n", h->regex); | 213 | LOG (GNUNET_ERROR_TYPE_DEBUG, " full: %s\n", h->regex); |
214 | REGEX_ITERNAL_iterate_all_edges (h->dfa, ®ex_iterator, h); | 214 | REGEX_INTERNAL_iterate_all_edges (h->dfa, ®ex_iterator, h); |
215 | } | 215 | } |
216 | 216 | ||
217 | 217 | ||
218 | void | 218 | void |
219 | REGEX_ITERNAL_announce_cancel (struct REGEX_ITERNAL_Announcement *h) | 219 | REGEX_INTERNAL_announce_cancel (struct REGEX_INTERNAL_Announcement *h) |
220 | { | 220 | { |
221 | REGEX_ITERNAL_automaton_destroy (h->dfa); | 221 | REGEX_INTERNAL_automaton_destroy (h->dfa); |
222 | GNUNET_free (h); | 222 | GNUNET_free (h); |
223 | } | 223 | } |
224 | 224 | ||
@@ -241,7 +241,7 @@ struct RegexSearchContext | |||
241 | /** | 241 | /** |
242 | * Information about the search. | 242 | * Information about the search. |
243 | */ | 243 | */ |
244 | struct REGEX_ITERNAL_Search *info; | 244 | struct REGEX_INTERNAL_Search *info; |
245 | 245 | ||
246 | /** | 246 | /** |
247 | * We just want to look for one edge, the longer the better. | 247 | * We just want to look for one edge, the longer the better. |
@@ -260,7 +260,7 @@ struct RegexSearchContext | |||
260 | * Struct to keep information of searches of services described by a regex | 260 | * Struct to keep information of searches of services described by a regex |
261 | * using a user-provided string service description. | 261 | * using a user-provided string service description. |
262 | */ | 262 | */ |
263 | struct REGEX_ITERNAL_Search | 263 | struct REGEX_INTERNAL_Search |
264 | { | 264 | { |
265 | /** | 265 | /** |
266 | * DHT handle to use, must be initialized externally. | 266 | * DHT handle to use, must be initialized externally. |
@@ -300,7 +300,7 @@ struct REGEX_ITERNAL_Search | |||
300 | /** | 300 | /** |
301 | * @param callback Callback for found peers. | 301 | * @param callback Callback for found peers. |
302 | */ | 302 | */ |
303 | REGEX_ITERNAL_Found callback; | 303 | REGEX_INTERNAL_Found callback; |
304 | 304 | ||
305 | /** | 305 | /** |
306 | * @param callback_cls Closure for @c callback. | 306 | * @param callback_cls Closure for @c callback. |
@@ -352,7 +352,7 @@ dht_get_string_accept_handler (void *cls, struct GNUNET_TIME_Absolute exp, | |||
352 | { | 352 | { |
353 | const struct RegexAccept *block = data; | 353 | const struct RegexAccept *block = data; |
354 | struct RegexSearchContext *ctx = cls; | 354 | struct RegexSearchContext *ctx = cls; |
355 | struct REGEX_ITERNAL_Search *info = ctx->info; | 355 | struct REGEX_INTERNAL_Search *info = ctx->info; |
356 | 356 | ||
357 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got regex results from DHT!\n"); | 357 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got regex results from DHT!\n"); |
358 | LOG (GNUNET_ERROR_TYPE_INFO, " accept for %s (key %s)\n", | 358 | LOG (GNUNET_ERROR_TYPE_INFO, " accept for %s (key %s)\n", |
@@ -430,7 +430,7 @@ dht_get_string_handler (void *cls, struct GNUNET_TIME_Absolute exp, | |||
430 | { | 430 | { |
431 | const struct RegexBlock *block = data; | 431 | const struct RegexBlock *block = data; |
432 | struct RegexSearchContext *ctx = cls; | 432 | struct RegexSearchContext *ctx = cls; |
433 | struct REGEX_ITERNAL_Search *info = ctx->info; | 433 | struct REGEX_INTERNAL_Search *info = ctx->info; |
434 | void *copy; | 434 | void *copy; |
435 | size_t len; | 435 | size_t len; |
436 | char *datastore; | 436 | char *datastore; |
@@ -466,7 +466,7 @@ dht_get_string_handler (void *cls, struct GNUNET_TIME_Absolute exp, | |||
466 | 466 | ||
467 | memcpy (proof, &block[1], len); | 467 | memcpy (proof, &block[1], len); |
468 | proof[len] = '\0'; | 468 | proof[len] = '\0'; |
469 | if (GNUNET_OK != REGEX_ITERNAL_check_proof (proof, key)) | 469 | if (GNUNET_OK != REGEX_INTERNAL_check_proof (proof, key)) |
470 | { | 470 | { |
471 | GNUNET_break_op (0); | 471 | GNUNET_break_op (0); |
472 | return; | 472 | return; |
@@ -543,7 +543,7 @@ regex_edge_iterator (void *cls, | |||
543 | const struct GNUNET_HashCode *key) | 543 | const struct GNUNET_HashCode *key) |
544 | { | 544 | { |
545 | struct RegexSearchContext *ctx = cls; | 545 | struct RegexSearchContext *ctx = cls; |
546 | struct REGEX_ITERNAL_Search *info = ctx->info; | 546 | struct REGEX_INTERNAL_Search *info = ctx->info; |
547 | const char *current; | 547 | const char *current; |
548 | size_t current_len; | 548 | size_t current_len; |
549 | 549 | ||
@@ -602,7 +602,7 @@ regex_next_edge (const struct RegexBlock *block, | |||
602 | struct RegexSearchContext *ctx) | 602 | struct RegexSearchContext *ctx) |
603 | { | 603 | { |
604 | struct RegexSearchContext *new_ctx; | 604 | struct RegexSearchContext *new_ctx; |
605 | struct REGEX_ITERNAL_Search *info = ctx->info; | 605 | struct REGEX_INTERNAL_Search *info = ctx->info; |
606 | struct GNUNET_DHT_GetHandle *get_h; | 606 | struct GNUNET_DHT_GetHandle *get_h; |
607 | struct GNUNET_HashCode *hash; | 607 | struct GNUNET_HashCode *hash; |
608 | const char *rest; | 608 | const char *rest; |
@@ -611,7 +611,7 @@ regex_next_edge (const struct RegexBlock *block, | |||
611 | /* Find the longest match for the current string position, | 611 | /* Find the longest match for the current string position, |
612 | * among tokens in the given block */ | 612 | * among tokens in the given block */ |
613 | ctx->longest_match = 0; | 613 | ctx->longest_match = 0; |
614 | result = REGEX_ITERNAL_block_iterate (block, size, | 614 | result = REGEX_INTERNAL_block_iterate (block, size, |
615 | ®ex_edge_iterator, ctx); | 615 | ®ex_edge_iterator, ctx); |
616 | GNUNET_break (GNUNET_OK == result); | 616 | GNUNET_break (GNUNET_OK == result); |
617 | 617 | ||
@@ -670,14 +670,14 @@ regex_next_edge (const struct RegexBlock *block, | |||
670 | } | 670 | } |
671 | 671 | ||
672 | 672 | ||
673 | struct REGEX_ITERNAL_Search * | 673 | struct REGEX_INTERNAL_Search * |
674 | REGEX_ITERNAL_search (struct GNUNET_DHT_Handle *dht, | 674 | REGEX_INTERNAL_search (struct GNUNET_DHT_Handle *dht, |
675 | const char *string, | 675 | const char *string, |
676 | REGEX_ITERNAL_Found callback, | 676 | REGEX_INTERNAL_Found callback, |
677 | void *callback_cls, | 677 | void *callback_cls, |
678 | struct GNUNET_STATISTICS_Handle *stats) | 678 | struct GNUNET_STATISTICS_Handle *stats) |
679 | { | 679 | { |
680 | struct REGEX_ITERNAL_Search *h; | 680 | struct REGEX_INTERNAL_Search *h; |
681 | struct GNUNET_DHT_GetHandle *get_h; | 681 | struct GNUNET_DHT_GetHandle *get_h; |
682 | struct RegexSearchContext *ctx; | 682 | struct RegexSearchContext *ctx; |
683 | struct GNUNET_HashCode key; | 683 | struct GNUNET_HashCode key; |
@@ -685,10 +685,10 @@ REGEX_ITERNAL_search (struct GNUNET_DHT_Handle *dht, | |||
685 | size_t len; | 685 | size_t len; |
686 | 686 | ||
687 | /* Initialize handle */ | 687 | /* Initialize handle */ |
688 | LOG (GNUNET_ERROR_TYPE_INFO, "REGEX_ITERNAL_search: %s\n", string); | 688 | LOG (GNUNET_ERROR_TYPE_INFO, "REGEX_INTERNAL_search: %s\n", string); |
689 | GNUNET_assert (NULL != dht); | 689 | GNUNET_assert (NULL != dht); |
690 | GNUNET_assert (NULL != callback); | 690 | GNUNET_assert (NULL != callback); |
691 | h = GNUNET_malloc (sizeof (struct REGEX_ITERNAL_Search)); | 691 | h = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Search)); |
692 | h->dht = dht; | 692 | h->dht = dht; |
693 | h->description = GNUNET_strdup (string); | 693 | h->description = GNUNET_strdup (string); |
694 | h->callback = callback; | 694 | h->callback = callback; |
@@ -699,7 +699,7 @@ REGEX_ITERNAL_search (struct GNUNET_DHT_Handle *dht, | |||
699 | 699 | ||
700 | /* Initialize context */ | 700 | /* Initialize context */ |
701 | len = strlen (string); | 701 | len = strlen (string); |
702 | size = REGEX_ITERNAL_get_first_key (string, len, &key); | 702 | size = REGEX_INTERNAL_get_first_key (string, len, &key); |
703 | ctx = GNUNET_malloc (sizeof (struct RegexSearchContext)); | 703 | ctx = GNUNET_malloc (sizeof (struct RegexSearchContext)); |
704 | ctx->position = size; | 704 | ctx->position = size; |
705 | ctx->info = h; | 705 | ctx->info = h; |
@@ -779,7 +779,7 @@ regex_free_result (void *cls, | |||
779 | * @param ctx The search context. | 779 | * @param ctx The search context. |
780 | */ | 780 | */ |
781 | static void | 781 | static void |
782 | regex_cancel_search (struct REGEX_ITERNAL_Search *ctx) | 782 | regex_cancel_search (struct REGEX_INTERNAL_Search *ctx) |
783 | { | 783 | { |
784 | GNUNET_free (ctx->description); | 784 | GNUNET_free (ctx->description); |
785 | GNUNET_CONTAINER_multihashmap_iterate (ctx->dht_get_handles, | 785 | GNUNET_CONTAINER_multihashmap_iterate (ctx->dht_get_handles, |
@@ -801,7 +801,7 @@ regex_cancel_search (struct REGEX_ITERNAL_Search *ctx) | |||
801 | } | 801 | } |
802 | 802 | ||
803 | void | 803 | void |
804 | REGEX_ITERNAL_search_cancel (struct REGEX_ITERNAL_Search *h) | 804 | REGEX_INTERNAL_search_cancel (struct REGEX_INTERNAL_Search *h) |
805 | { | 805 | { |
806 | regex_cancel_search (h); | 806 | regex_cancel_search (h); |
807 | GNUNET_free (h); | 807 | GNUNET_free (h); |
diff --git a/src/regex/regex_internal_lib.h b/src/regex/regex_internal_lib.h index e138535d4..7da08154d 100644 --- a/src/regex/regex_internal_lib.h +++ b/src/regex/regex_internal_lib.h | |||
@@ -42,13 +42,13 @@ extern "C" | |||
42 | /** | 42 | /** |
43 | * Automaton (NFA/DFA) representation. | 43 | * Automaton (NFA/DFA) representation. |
44 | */ | 44 | */ |
45 | struct REGEX_ITERNAL_Automaton; | 45 | struct REGEX_INTERNAL_Automaton; |
46 | 46 | ||
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Edge representation. | 49 | * Edge representation. |
50 | */ | 50 | */ |
51 | struct REGEX_ITERNAL_Edge | 51 | struct REGEX_INTERNAL_Edge |
52 | { | 52 | { |
53 | /** | 53 | /** |
54 | * Label of the edge. FIXME: might want to not consume exactly multiples of 8 bits, need length? | 54 | * Label of the edge. FIXME: might want to not consume exactly multiples of 8 bits, need length? |
@@ -77,21 +77,21 @@ struct REGEX_ITERNAL_Edge | |||
77 | * @param max_path_len limit the path compression length to the | 77 | * @param max_path_len limit the path compression length to the |
78 | * given value. If set to 1, no path compression is applied. Set to 0 for | 78 | * given value. If set to 1, no path compression is applied. Set to 0 for |
79 | * maximal possible path compression (generally not desireable). | 79 | * maximal possible path compression (generally not desireable). |
80 | * @return DFA, needs to be freed using REGEX_ITERNAL_automaton_destroy. | 80 | * @return DFA, needs to be freed using REGEX_INTERNAL_automaton_destroy. |
81 | */ | 81 | */ |
82 | struct REGEX_ITERNAL_Automaton * | 82 | struct REGEX_INTERNAL_Automaton * |
83 | REGEX_ITERNAL_construct_dfa (const char *regex, const size_t len, | 83 | REGEX_INTERNAL_construct_dfa (const char *regex, const size_t len, |
84 | unsigned int max_path_len); | 84 | unsigned int max_path_len); |
85 | 85 | ||
86 | 86 | ||
87 | /** | 87 | /** |
88 | * Free the memory allocated by constructing the REGEX_ITERNAL_Automaton. | 88 | * Free the memory allocated by constructing the REGEX_INTERNAL_Automaton. |
89 | * data structure. | 89 | * data structure. |
90 | * | 90 | * |
91 | * @param a automaton to be destroyed. | 91 | * @param a automaton to be destroyed. |
92 | */ | 92 | */ |
93 | void | 93 | void |
94 | REGEX_ITERNAL_automaton_destroy (struct REGEX_ITERNAL_Automaton *a); | 94 | REGEX_INTERNAL_automaton_destroy (struct REGEX_INTERNAL_Automaton *a); |
95 | 95 | ||
96 | 96 | ||
97 | /** | 97 | /** |
@@ -103,7 +103,7 @@ REGEX_ITERNAL_automaton_destroy (struct REGEX_ITERNAL_Automaton *a); | |||
103 | * @return 0 if string matches, non 0 otherwise. | 103 | * @return 0 if string matches, non 0 otherwise. |
104 | */ | 104 | */ |
105 | int | 105 | int |
106 | REGEX_ITERNAL_eval (struct REGEX_ITERNAL_Automaton *a, | 106 | REGEX_INTERNAL_eval (struct REGEX_INTERNAL_Automaton *a, |
107 | const char *string); | 107 | const char *string); |
108 | 108 | ||
109 | 109 | ||
@@ -119,7 +119,7 @@ REGEX_ITERNAL_eval (struct REGEX_ITERNAL_Automaton *a, | |||
119 | * to construct the key | 119 | * to construct the key |
120 | */ | 120 | */ |
121 | size_t | 121 | size_t |
122 | REGEX_ITERNAL_get_first_key (const char *input_string, size_t string_len, | 122 | REGEX_INTERNAL_get_first_key (const char *input_string, size_t string_len, |
123 | struct GNUNET_HashCode * key); | 123 | struct GNUNET_HashCode * key); |
124 | 124 | ||
125 | 125 | ||
@@ -132,7 +132,7 @@ REGEX_ITERNAL_get_first_key (const char *input_string, size_t string_len, | |||
132 | * @return GNUNET_OK if the proof is valid for the given key. | 132 | * @return GNUNET_OK if the proof is valid for the given key. |
133 | */ | 133 | */ |
134 | int | 134 | int |
135 | REGEX_ITERNAL_check_proof (const char *proof, | 135 | REGEX_INTERNAL_check_proof (const char *proof, |
136 | const struct GNUNET_HashCode *key); | 136 | const struct GNUNET_HashCode *key); |
137 | 137 | ||
138 | 138 | ||
@@ -146,12 +146,12 @@ REGEX_ITERNAL_check_proof (const char *proof, | |||
146 | * @param num_edges number of edges leaving current state. | 146 | * @param num_edges number of edges leaving current state. |
147 | * @param edges edges leaving current state. | 147 | * @param edges edges leaving current state. |
148 | */ | 148 | */ |
149 | typedef void (*REGEX_ITERNAL_KeyIterator)(void *cls, | 149 | typedef void (*REGEX_INTERNAL_KeyIterator)(void *cls, |
150 | const struct GNUNET_HashCode *key, | 150 | const struct GNUNET_HashCode *key, |
151 | const char *proof, | 151 | const char *proof, |
152 | int accepting, | 152 | int accepting, |
153 | unsigned int num_edges, | 153 | unsigned int num_edges, |
154 | const struct REGEX_ITERNAL_Edge *edges); | 154 | const struct REGEX_INTERNAL_Edge *edges); |
155 | 155 | ||
156 | 156 | ||
157 | /** | 157 | /** |
@@ -163,8 +163,8 @@ typedef void (*REGEX_ITERNAL_KeyIterator)(void *cls, | |||
163 | * @param iterator_cls closure. | 163 | * @param iterator_cls closure. |
164 | */ | 164 | */ |
165 | void | 165 | void |
166 | REGEX_ITERNAL_iterate_all_edges (struct REGEX_ITERNAL_Automaton *a, | 166 | REGEX_INTERNAL_iterate_all_edges (struct REGEX_INTERNAL_Automaton *a, |
167 | REGEX_ITERNAL_KeyIterator iterator, | 167 | REGEX_INTERNAL_KeyIterator iterator, |
168 | void *iterator_cls); | 168 | void *iterator_cls); |
169 | 169 | ||
170 | 170 | ||
@@ -172,16 +172,16 @@ REGEX_ITERNAL_iterate_all_edges (struct REGEX_ITERNAL_Automaton *a, | |||
172 | /** | 172 | /** |
173 | * Handle to store cached data about a regex announce. | 173 | * Handle to store cached data about a regex announce. |
174 | */ | 174 | */ |
175 | struct REGEX_ITERNAL_Announcement; | 175 | struct REGEX_INTERNAL_Announcement; |
176 | 176 | ||
177 | /** | 177 | /** |
178 | * Handle to store data about a regex search. | 178 | * Handle to store data about a regex search. |
179 | */ | 179 | */ |
180 | struct REGEX_ITERNAL_Search; | 180 | struct REGEX_INTERNAL_Search; |
181 | 181 | ||
182 | /** | 182 | /** |
183 | * Announce a regular expression: put all states of the automaton in the DHT. | 183 | * Announce a regular expression: put all states of the automaton in the DHT. |
184 | * Does not free resources, must call REGEX_ITERNAL_announce_cancel for that. | 184 | * Does not free resources, must call REGEX_INTERNAL_announce_cancel for that. |
185 | * | 185 | * |
186 | * @param dht An existing and valid DHT service handle. CANNOT be NULL. | 186 | * @param dht An existing and valid DHT service handle. CANNOT be NULL. |
187 | * @param id ID to announce as provider of regex. Own ID in most cases. | 187 | * @param id ID to announce as provider of regex. Own ID in most cases. |
@@ -190,10 +190,10 @@ struct REGEX_ITERNAL_Search; | |||
190 | * @param stats Optional statistics handle to report usage. Can be NULL. | 190 | * @param stats Optional statistics handle to report usage. Can be NULL. |
191 | * | 191 | * |
192 | * @return Handle to reuse o free cached resources. | 192 | * @return Handle to reuse o free cached resources. |
193 | * Must be freed by calling REGEX_ITERNAL_announce_cancel. | 193 | * Must be freed by calling REGEX_INTERNAL_announce_cancel. |
194 | */ | 194 | */ |
195 | struct REGEX_ITERNAL_Announcement * | 195 | struct REGEX_INTERNAL_Announcement * |
196 | REGEX_ITERNAL_announce (struct GNUNET_DHT_Handle *dht, | 196 | REGEX_INTERNAL_announce (struct GNUNET_DHT_Handle *dht, |
197 | const struct GNUNET_PeerIdentity *id, | 197 | const struct GNUNET_PeerIdentity *id, |
198 | const char *regex, | 198 | const char *regex, |
199 | uint16_t compression, | 199 | uint16_t compression, |
@@ -203,33 +203,33 @@ REGEX_ITERNAL_announce (struct GNUNET_DHT_Handle *dht, | |||
203 | * Announce again a regular expression previously announced. | 203 | * Announce again a regular expression previously announced. |
204 | * Does use caching to speed up process. | 204 | * Does use caching to speed up process. |
205 | * | 205 | * |
206 | * @param h Handle returned by a previous REGEX_ITERNAL_announce call. | 206 | * @param h Handle returned by a previous REGEX_INTERNAL_announce call. |
207 | */ | 207 | */ |
208 | void | 208 | void |
209 | REGEX_ITERNAL_reannounce (struct REGEX_ITERNAL_Announcement *h); | 209 | REGEX_INTERNAL_reannounce (struct REGEX_INTERNAL_Announcement *h); |
210 | 210 | ||
211 | 211 | ||
212 | /** | 212 | /** |
213 | * Clear all cached data used by a regex announce. | 213 | * Clear all cached data used by a regex announce. |
214 | * Does not close DHT connection. | 214 | * Does not close DHT connection. |
215 | * | 215 | * |
216 | * @param h Handle returned by a previous REGEX_ITERNAL_announce call. | 216 | * @param h Handle returned by a previous REGEX_INTERNAL_announce call. |
217 | */ | 217 | */ |
218 | void | 218 | void |
219 | REGEX_ITERNAL_announce_cancel (struct REGEX_ITERNAL_Announcement *h); | 219 | REGEX_INTERNAL_announce_cancel (struct REGEX_INTERNAL_Announcement *h); |
220 | 220 | ||
221 | 221 | ||
222 | /** | 222 | /** |
223 | * Search callback function. | 223 | * Search callback function. |
224 | * | 224 | * |
225 | * @param cls Closure provided in REGEX_ITERNAL_search. | 225 | * @param cls Closure provided in REGEX_INTERNAL_search. |
226 | * @param id Peer providing a regex that matches the string. | 226 | * @param id Peer providing a regex that matches the string. |
227 | * @param get_path Path of the get request. | 227 | * @param get_path Path of the get request. |
228 | * @param get_path_length Lenght of get_path. | 228 | * @param get_path_length Lenght of get_path. |
229 | * @param put_path Path of the put request. | 229 | * @param put_path Path of the put request. |
230 | * @param put_path_length Length of the put_path. | 230 | * @param put_path_length Length of the put_path. |
231 | */ | 231 | */ |
232 | typedef void (*REGEX_ITERNAL_Found)(void *cls, | 232 | typedef void (*REGEX_INTERNAL_Found)(void *cls, |
233 | const struct GNUNET_PeerIdentity *id, | 233 | const struct GNUNET_PeerIdentity *id, |
234 | const struct GNUNET_PeerIdentity *get_path, | 234 | const struct GNUNET_PeerIdentity *get_path, |
235 | unsigned int get_path_length, | 235 | unsigned int get_path_length, |
@@ -239,7 +239,7 @@ typedef void (*REGEX_ITERNAL_Found)(void *cls, | |||
239 | 239 | ||
240 | /** | 240 | /** |
241 | * Search for a peer offering a regex matching certain string in the DHT. | 241 | * Search for a peer offering a regex matching certain string in the DHT. |
242 | * The search runs until REGEX_ITERNAL_search_cancel is called, even if results | 242 | * The search runs until REGEX_INTERNAL_search_cancel is called, even if results |
243 | * are returned. | 243 | * are returned. |
244 | * | 244 | * |
245 | * @param dht An existing and valid DHT service handle. | 245 | * @param dht An existing and valid DHT service handle. |
@@ -249,23 +249,23 @@ typedef void (*REGEX_ITERNAL_Found)(void *cls, | |||
249 | * @param stats Optional statistics handle to report usage. Can be NULL. | 249 | * @param stats Optional statistics handle to report usage. Can be NULL. |
250 | * | 250 | * |
251 | * @return Handle to stop search and free resources. | 251 | * @return Handle to stop search and free resources. |
252 | * Must be freed by calling REGEX_ITERNAL_search_cancel. | 252 | * Must be freed by calling REGEX_INTERNAL_search_cancel. |
253 | */ | 253 | */ |
254 | struct REGEX_ITERNAL_Search * | 254 | struct REGEX_INTERNAL_Search * |
255 | REGEX_ITERNAL_search (struct GNUNET_DHT_Handle *dht, | 255 | REGEX_INTERNAL_search (struct GNUNET_DHT_Handle *dht, |
256 | const char *string, | 256 | const char *string, |
257 | REGEX_ITERNAL_Found callback, | 257 | REGEX_INTERNAL_Found callback, |
258 | void *callback_cls, | 258 | void *callback_cls, |
259 | struct GNUNET_STATISTICS_Handle *stats); | 259 | struct GNUNET_STATISTICS_Handle *stats); |
260 | 260 | ||
261 | /** | 261 | /** |
262 | * Stop search and free all data used by a REGEX_ITERNAL_search call. | 262 | * Stop search and free all data used by a REGEX_INTERNAL_search call. |
263 | * Does not close DHT connection. | 263 | * Does not close DHT connection. |
264 | * | 264 | * |
265 | * @param h Handle returned by a previous REGEX_ITERNAL_search call. | 265 | * @param h Handle returned by a previous REGEX_INTERNAL_search call. |
266 | */ | 266 | */ |
267 | void | 267 | void |
268 | REGEX_ITERNAL_search_cancel (struct REGEX_ITERNAL_Search *h); | 268 | REGEX_INTERNAL_search_cancel (struct REGEX_INTERNAL_Search *h); |
269 | 269 | ||
270 | 270 | ||
271 | #if 0 /* keep Emacsens' auto-indent happy */ | 271 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/regex/regex_test_graph.c b/src/regex/regex_test_graph.c index 369356aa1..0684da711 100644 --- a/src/regex/regex_test_graph.c +++ b/src/regex/regex_test_graph.c | |||
@@ -29,9 +29,9 @@ | |||
29 | 29 | ||
30 | /** | 30 | /** |
31 | * Context for graph creation. Passed as the cls to | 31 | * Context for graph creation. Passed as the cls to |
32 | * REGEX_ITERNAL_automaton_save_graph_step. | 32 | * REGEX_TEST_automaton_save_graph_step. |
33 | */ | 33 | */ |
34 | struct REGEX_ITERNAL_Graph_Context | 34 | struct REGEX_TEST_Graph_Context |
35 | { | 35 | { |
36 | /** | 36 | /** |
37 | * File pointer to the dot file used for output. | 37 | * File pointer to the dot file used for output. |
@@ -64,12 +64,12 @@ struct REGEX_ITERNAL_Graph_Context | |||
64 | */ | 64 | */ |
65 | static void | 65 | static void |
66 | scc_tarjan_strongconnect (unsigned int *scc_counter, | 66 | scc_tarjan_strongconnect (unsigned int *scc_counter, |
67 | struct REGEX_ITERNAL_State *v, unsigned int *index, | 67 | struct REGEX_INTERNAL_State *v, unsigned int *index, |
68 | struct REGEX_ITERNAL_State **stack, | 68 | struct REGEX_INTERNAL_State **stack, |
69 | unsigned int *stack_size) | 69 | unsigned int *stack_size) |
70 | { | 70 | { |
71 | struct REGEX_ITERNAL_State *w; | 71 | struct REGEX_INTERNAL_State *w; |
72 | struct REGEX_ITERNAL_Transition *t; | 72 | struct REGEX_INTERNAL_Transition *t; |
73 | 73 | ||
74 | v->index = *index; | 74 | v->index = *index; |
75 | v->lowlink = *index; | 75 | v->lowlink = *index; |
@@ -114,12 +114,12 @@ scc_tarjan_strongconnect (unsigned int *scc_counter, | |||
114 | * @param a the automaton for which SCCs should be computed and assigned. | 114 | * @param a the automaton for which SCCs should be computed and assigned. |
115 | */ | 115 | */ |
116 | static void | 116 | static void |
117 | scc_tarjan (struct REGEX_ITERNAL_Automaton *a) | 117 | scc_tarjan (struct REGEX_INTERNAL_Automaton *a) |
118 | { | 118 | { |
119 | unsigned int index; | 119 | unsigned int index; |
120 | unsigned int scc_counter; | 120 | unsigned int scc_counter; |
121 | struct REGEX_ITERNAL_State *v; | 121 | struct REGEX_INTERNAL_State *v; |
122 | struct REGEX_ITERNAL_State *stack[a->state_count]; | 122 | struct REGEX_INTERNAL_State *stack[a->state_count]; |
123 | unsigned int stack_size; | 123 | unsigned int stack_size; |
124 | 124 | ||
125 | for (v = a->states_head; NULL != v; v = v->next) | 125 | for (v = a->states_head; NULL != v; v = v->next) |
@@ -144,18 +144,18 @@ scc_tarjan (struct REGEX_ITERNAL_Automaton *a) | |||
144 | /** | 144 | /** |
145 | * Save a state to an open file pointer. cls is expected to be a file pointer to | 145 | * Save a state to an open file pointer. cls is expected to be a file pointer to |
146 | * an open file. Used only in conjunction with | 146 | * an open file. Used only in conjunction with |
147 | * REGEX_ITERNAL_automaton_save_graph. | 147 | * REGEX_TEST_automaton_save_graph. |
148 | * | 148 | * |
149 | * @param cls file pointer. | 149 | * @param cls file pointer. |
150 | * @param count current count of the state, not used. | 150 | * @param count current count of the state, not used. |
151 | * @param s state. | 151 | * @param s state. |
152 | */ | 152 | */ |
153 | void | 153 | void |
154 | REGEX_ITERNAL_automaton_save_graph_step (void *cls, unsigned int count, | 154 | REGEX_TEST_automaton_save_graph_step (void *cls, unsigned int count, |
155 | struct REGEX_ITERNAL_State *s) | 155 | struct REGEX_INTERNAL_State *s) |
156 | { | 156 | { |
157 | struct REGEX_ITERNAL_Graph_Context *ctx = cls; | 157 | struct REGEX_TEST_Graph_Context *ctx = cls; |
158 | struct REGEX_ITERNAL_Transition *ctran; | 158 | struct REGEX_INTERNAL_Transition *ctran; |
159 | char *s_acc = NULL; | 159 | char *s_acc = NULL; |
160 | char *s_tran = NULL; | 160 | char *s_tran = NULL; |
161 | char *name; | 161 | char *name; |
@@ -268,13 +268,13 @@ REGEX_ITERNAL_automaton_save_graph_step (void *cls, unsigned int count, | |||
268 | * mode | 268 | * mode |
269 | */ | 269 | */ |
270 | void | 270 | void |
271 | REGEX_ITERNAL_automaton_save_graph (struct REGEX_ITERNAL_Automaton *a, | 271 | REGEX_TEST_automaton_save_graph (struct REGEX_INTERNAL_Automaton *a, |
272 | const char *filename, | 272 | const char *filename, |
273 | enum REGEX_ITERNAL_GraphSavingOptions options) | 273 | enum REGEX_TEST_GraphSavingOptions options) |
274 | { | 274 | { |
275 | char *start; | 275 | char *start; |
276 | char *end; | 276 | char *end; |
277 | struct REGEX_ITERNAL_Graph_Context ctx; | 277 | struct REGEX_TEST_Graph_Context ctx; |
278 | 278 | ||
279 | if (NULL == a) | 279 | if (NULL == a) |
280 | { | 280 | { |
@@ -290,9 +290,9 @@ REGEX_ITERNAL_automaton_save_graph (struct REGEX_ITERNAL_Automaton *a, | |||
290 | 290 | ||
291 | ctx.filep = fopen (filename, "w"); | 291 | ctx.filep = fopen (filename, "w"); |
292 | ctx.verbose = | 292 | ctx.verbose = |
293 | (0 == (options & REGEX_ITERNAL_GRAPH_VERBOSE)) ? GNUNET_NO : GNUNET_YES; | 293 | (0 == (options & REGEX_TEST_GRAPH_VERBOSE)) ? GNUNET_NO : GNUNET_YES; |
294 | ctx.coloring = | 294 | ctx.coloring = |
295 | (0 == (options & REGEX_ITERNAL_GRAPH_COLORING)) ? GNUNET_NO : GNUNET_YES; | 295 | (0 == (options & REGEX_TEST_GRAPH_COLORING)) ? GNUNET_NO : GNUNET_YES; |
296 | 296 | ||
297 | if (NULL == ctx.filep) | 297 | if (NULL == ctx.filep) |
298 | { | 298 | { |
@@ -308,8 +308,8 @@ REGEX_ITERNAL_automaton_save_graph (struct REGEX_ITERNAL_Automaton *a, | |||
308 | start = "digraph G {\nrankdir=LR\n"; | 308 | start = "digraph G {\nrankdir=LR\n"; |
309 | fwrite (start, strlen (start), 1, ctx.filep); | 309 | fwrite (start, strlen (start), 1, ctx.filep); |
310 | 310 | ||
311 | REGEX_ITERNAL_automaton_traverse (a, a->start, NULL, NULL, | 311 | REGEX_INTERNAL_automaton_traverse (a, a->start, NULL, NULL, |
312 | ®EX_ITERNAL_automaton_save_graph_step, | 312 | ®EX_TEST_automaton_save_graph_step, |
313 | &ctx); | 313 | &ctx); |
314 | 314 | ||
315 | end = "\n}\n"; | 315 | end = "\n}\n"; |
diff --git a/src/regex/regex_test_lib.c b/src/regex/regex_test_lib.c index dbb864370..d39db7ef8 100644 --- a/src/regex/regex_test_lib.c +++ b/src/regex/regex_test_lib.c | |||
@@ -305,7 +305,7 @@ regex_ctx_destroy (struct RegexCombineCtx *ctx) | |||
305 | * This function DOES NOT support arbitrary regex combining. | 305 | * This function DOES NOT support arbitrary regex combining. |
306 | */ | 306 | */ |
307 | char * | 307 | char * |
308 | REGEX_ITERNAL_combine (char * const regexes[]) | 308 | REGEX_TEST_combine (char * const regexes[]) |
309 | { | 309 | { |
310 | unsigned int i; | 310 | unsigned int i; |
311 | char *combined; | 311 | char *combined; |
@@ -333,15 +333,15 @@ REGEX_ITERNAL_combine (char * const regexes[]) | |||
333 | 333 | ||
334 | /** | 334 | /** |
335 | * Read a set of regexes from a file, one per line and return them in an array | 335 | * Read a set of regexes from a file, one per line and return them in an array |
336 | * suitable for REGEX_ITERNAL_combine. | 336 | * suitable for REGEX_TEST_combine. |
337 | * The array must be free'd using REGEX_ITERNAL_free_from_file. | 337 | * The array must be free'd using REGEX_TEST_free_from_file. |
338 | * | 338 | * |
339 | * @param filename Name of the file containing the regexes. | 339 | * @param filename Name of the file containing the regexes. |
340 | * | 340 | * |
341 | * @return A newly allocated, NULL terminated array of regexes. | 341 | * @return A newly allocated, NULL terminated array of regexes. |
342 | */ | 342 | */ |
343 | char ** | 343 | char ** |
344 | REGEX_ITERNAL_read_from_file (const char *filename) | 344 | REGEX_TEST_read_from_file (const char *filename) |
345 | { | 345 | { |
346 | struct GNUNET_DISK_FileHandle *f; | 346 | struct GNUNET_DISK_FileHandle *f; |
347 | unsigned int nr; | 347 | unsigned int nr; |
@@ -421,7 +421,7 @@ REGEX_ITERNAL_read_from_file (const char *filename) | |||
421 | * @param regexes NULL-terminated array of regexes. | 421 | * @param regexes NULL-terminated array of regexes. |
422 | */ | 422 | */ |
423 | void | 423 | void |
424 | REGEX_ITERNAL_free_from_file (char **regexes) | 424 | REGEX_TEST_free_from_file (char **regexes) |
425 | { | 425 | { |
426 | unsigned int i; | 426 | unsigned int i; |
427 | 427 | ||
diff --git a/src/regex/regex_test_lib.h b/src/regex/regex_test_lib.h index 107c2ffce..87dcadf72 100644 --- a/src/regex/regex_test_lib.h +++ b/src/regex/regex_test_lib.h | |||
@@ -25,8 +25,8 @@ | |||
25 | * @author Bertlomiej Polot | 25 | * @author Bertlomiej Polot |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef REGEX_ITERNAL_TEST_LIB_H | 28 | #ifndef REGEX_INTERNAL_TEST_LIB_H |
29 | #define REGEX_ITERNAL_TEST_LIB_H | 29 | #define REGEX_INTERNAL_TEST_LIB_H |
30 | 30 | ||
31 | #include "regex_internal_lib.h" | 31 | #include "regex_internal_lib.h" |
32 | 32 | ||
@@ -46,20 +46,20 @@ extern "C" | |||
46 | * @return A string with a single regex that matches any of the original regexes | 46 | * @return A string with a single regex that matches any of the original regexes |
47 | */ | 47 | */ |
48 | char * | 48 | char * |
49 | REGEX_ITERNAL_combine(char * const regexes[]); | 49 | REGEX_TEST_combine(char * const regexes[]); |
50 | 50 | ||
51 | 51 | ||
52 | /** | 52 | /** |
53 | * Read a set of regexes from a file, one per line and return them in an array | 53 | * Read a set of regexes from a file, one per line and return them in an array |
54 | * suitable for REGEX_ITERNAL_combine. | 54 | * suitable for REGEX_TEST_combine. |
55 | * The array must be free'd using REGEX_ITERNAL_free_from_file. | 55 | * The array must be free'd using REGEX_TEST_free_from_file. |
56 | * | 56 | * |
57 | * @param filename Name of the file containing the regexes. | 57 | * @param filename Name of the file containing the regexes. |
58 | * | 58 | * |
59 | * @return A newly allocated, NULL terminated array of regexes. | 59 | * @return A newly allocated, NULL terminated array of regexes. |
60 | */ | 60 | */ |
61 | char ** | 61 | char ** |
62 | REGEX_ITERNAL_read_from_file (const char *filename); | 62 | REGEX_TEST_read_from_file (const char *filename); |
63 | 63 | ||
64 | 64 | ||
65 | /** | 65 | /** |
@@ -68,7 +68,7 @@ REGEX_ITERNAL_read_from_file (const char *filename); | |||
68 | * @param regexes NULL-terminated array of regexes. | 68 | * @param regexes NULL-terminated array of regexes. |
69 | */ | 69 | */ |
70 | void | 70 | void |
71 | REGEX_ITERNAL_free_from_file (char **regexes); | 71 | REGEX_TEST_free_from_file (char **regexes); |
72 | 72 | ||
73 | 73 | ||
74 | /** | 74 | /** |
@@ -85,7 +85,7 @@ REGEX_ITERNAL_free_from_file (char **regexes); | |||
85 | * needs to be freed, otherwise. | 85 | * needs to be freed, otherwise. |
86 | */ | 86 | */ |
87 | char * | 87 | char * |
88 | REGEX_ITERNAL_generate_random_regex (size_t rx_length, char *matching_str); | 88 | REGEX_TEST_generate_random_regex (size_t rx_length, char *matching_str); |
89 | 89 | ||
90 | 90 | ||
91 | /** | 91 | /** |
@@ -98,30 +98,30 @@ REGEX_ITERNAL_generate_random_regex (size_t rx_length, char *matching_str); | |||
98 | * @return random string that needs to be freed. | 98 | * @return random string that needs to be freed. |
99 | */ | 99 | */ |
100 | char * | 100 | char * |
101 | REGEX_ITERNAL_generate_random_string (size_t max_len); | 101 | REGEX_TEST_generate_random_string (size_t max_len); |
102 | 102 | ||
103 | 103 | ||
104 | /** | 104 | /** |
105 | * Options for graph creation function | 105 | * Options for graph creation function |
106 | * REGEX_ITERNAL_automaton_save_graph. | 106 | * REGEX_TEST_automaton_save_graph. |
107 | */ | 107 | */ |
108 | enum REGEX_ITERNAL_GraphSavingOptions | 108 | enum REGEX_TEST_GraphSavingOptions |
109 | { | 109 | { |
110 | /** | 110 | /** |
111 | * Default. Do nothing special. | 111 | * Default. Do nothing special. |
112 | */ | 112 | */ |
113 | REGEX_ITERNAL_GRAPH_DEFAULT = 0, | 113 | REGEX_TEST_GRAPH_DEFAULT = 0, |
114 | 114 | ||
115 | /** | 115 | /** |
116 | * The generated graph will include extra information such as the NFA states | 116 | * The generated graph will include extra information such as the NFA states |
117 | * that were used to generate the DFA state. | 117 | * that were used to generate the DFA state. |
118 | */ | 118 | */ |
119 | REGEX_ITERNAL_GRAPH_VERBOSE = 1, | 119 | REGEX_TEST_GRAPH_VERBOSE = 1, |
120 | 120 | ||
121 | /** | 121 | /** |
122 | * Enable graph coloring. Will color each SCC in a different color. | 122 | * Enable graph coloring. Will color each SCC in a different color. |
123 | */ | 123 | */ |
124 | REGEX_ITERNAL_GRAPH_COLORING = 2 | 124 | REGEX_TEST_GRAPH_COLORING = 2 |
125 | }; | 125 | }; |
126 | 126 | ||
127 | 127 | ||
@@ -134,9 +134,9 @@ enum REGEX_ITERNAL_GraphSavingOptions | |||
134 | * mode | 134 | * mode |
135 | */ | 135 | */ |
136 | void | 136 | void |
137 | REGEX_ITERNAL_automaton_save_graph (struct REGEX_ITERNAL_Automaton *a, | 137 | REGEX_TEST_automaton_save_graph (struct REGEX_INTERNAL_Automaton *a, |
138 | const char *filename, | 138 | const char *filename, |
139 | enum REGEX_ITERNAL_GraphSavingOptions options); | 139 | enum REGEX_TEST_GraphSavingOptions options); |
140 | 140 | ||
141 | 141 | ||
142 | 142 | ||
diff --git a/src/regex/regex_test_random.c b/src/regex/regex_test_random.c index 00e4c21b3..8564da9db 100644 --- a/src/regex/regex_test_random.c +++ b/src/regex/regex_test_random.c | |||
@@ -61,7 +61,7 @@ get_random_literal () | |||
61 | * needs to be freed, otherwise. | 61 | * needs to be freed, otherwise. |
62 | */ | 62 | */ |
63 | char * | 63 | char * |
64 | REGEX_ITERNAL_generate_random_regex (size_t rx_length, char *matching_str) | 64 | REGEX_TEST_generate_random_regex (size_t rx_length, char *matching_str) |
65 | { | 65 | { |
66 | char *rx; | 66 | char *rx; |
67 | char *rx_p; | 67 | char *rx_p; |
@@ -148,7 +148,7 @@ REGEX_ITERNAL_generate_random_regex (size_t rx_length, char *matching_str) | |||
148 | * @return random string that needs to be freed. | 148 | * @return random string that needs to be freed. |
149 | */ | 149 | */ |
150 | char * | 150 | char * |
151 | REGEX_ITERNAL_generate_random_string (size_t max_len) | 151 | REGEX_TEST_generate_random_string (size_t max_len) |
152 | { | 152 | { |
153 | unsigned int i; | 153 | unsigned int i; |
154 | char *str; | 154 | char *str; |
diff --git a/src/regex/test_regex_eval_api.c b/src/regex/test_regex_eval_api.c index 3ab914dc1..a3dffc022 100644 --- a/src/regex/test_regex_eval_api.c +++ b/src/regex/test_regex_eval_api.c | |||
@@ -67,7 +67,7 @@ test_random (unsigned int rx_length, unsigned int max_str_len, | |||
67 | int eval_check; | 67 | int eval_check; |
68 | int eval_canonical; | 68 | int eval_canonical; |
69 | int eval_canonical_check; | 69 | int eval_canonical_check; |
70 | struct REGEX_ITERNAL_Automaton *dfa; | 70 | struct REGEX_INTERNAL_Automaton *dfa; |
71 | regex_t rx; | 71 | regex_t rx; |
72 | regmatch_t matchptr[1]; | 72 | regmatch_t matchptr[1]; |
73 | char error[200]; | 73 | char error[200]; |
@@ -81,7 +81,7 @@ test_random (unsigned int rx_length, unsigned int max_str_len, | |||
81 | 81 | ||
82 | /* Generate random regex and a string that matches the regex */ | 82 | /* Generate random regex and a string that matches the regex */ |
83 | matching_str = GNUNET_malloc (rx_length + 1); | 83 | matching_str = GNUNET_malloc (rx_length + 1); |
84 | rand_rx = REGEX_ITERNAL_generate_random_regex (rx_length, matching_str); | 84 | rand_rx = REGEX_TEST_generate_random_regex (rx_length, matching_str); |
85 | 85 | ||
86 | /* Now match */ | 86 | /* Now match */ |
87 | result = 0; | 87 | result = 0; |
@@ -89,21 +89,21 @@ test_random (unsigned int rx_length, unsigned int max_str_len, | |||
89 | { | 89 | { |
90 | if (0 < i) | 90 | if (0 < i) |
91 | { | 91 | { |
92 | matching_str = REGEX_ITERNAL_generate_random_string (max_str_len); | 92 | matching_str = REGEX_TEST_generate_random_string (max_str_len); |
93 | } | 93 | } |
94 | 94 | ||
95 | /* Match string using DFA */ | 95 | /* Match string using DFA */ |
96 | dfa = REGEX_ITERNAL_construct_dfa (rand_rx, strlen (rand_rx), 0); | 96 | dfa = REGEX_INTERNAL_construct_dfa (rand_rx, strlen (rand_rx), 0); |
97 | if (NULL == dfa) | 97 | if (NULL == dfa) |
98 | { | 98 | { |
99 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Constructing DFA failed\n"); | 99 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Constructing DFA failed\n"); |
100 | goto error; | 100 | goto error; |
101 | } | 101 | } |
102 | 102 | ||
103 | eval = REGEX_ITERNAL_eval (dfa, matching_str); | 103 | eval = REGEX_INTERNAL_eval (dfa, matching_str); |
104 | /* save the canonical regex for later comparison */ | 104 | /* save the canonical regex for later comparison */ |
105 | canonical_regex = GNUNET_strdup (REGEX_ITERNAL_get_canonical_regex (dfa)); | 105 | canonical_regex = GNUNET_strdup (REGEX_INTERNAL_get_canonical_regex (dfa)); |
106 | REGEX_ITERNAL_automaton_destroy (dfa); | 106 | REGEX_INTERNAL_automaton_destroy (dfa); |
107 | 107 | ||
108 | /* Match string using glibc regex */ | 108 | /* Match string using glibc regex */ |
109 | if (0 != regcomp (&rx, rand_rx, REG_EXTENDED)) | 109 | if (0 != regcomp (&rx, rand_rx, REG_EXTENDED)) |
@@ -124,7 +124,7 @@ test_random (unsigned int rx_length, unsigned int max_str_len, | |||
124 | 124 | ||
125 | /* Match canonical regex */ | 125 | /* Match canonical regex */ |
126 | dfa = | 126 | dfa = |
127 | REGEX_ITERNAL_construct_dfa (canonical_regex, strlen (canonical_regex), | 127 | REGEX_INTERNAL_construct_dfa (canonical_regex, strlen (canonical_regex), |
128 | 0); | 128 | 0); |
129 | if (NULL == dfa) | 129 | if (NULL == dfa) |
130 | { | 130 | { |
@@ -132,8 +132,8 @@ test_random (unsigned int rx_length, unsigned int max_str_len, | |||
132 | goto error; | 132 | goto error; |
133 | } | 133 | } |
134 | 134 | ||
135 | eval_canonical = REGEX_ITERNAL_eval (dfa, matching_str); | 135 | eval_canonical = REGEX_INTERNAL_eval (dfa, matching_str); |
136 | REGEX_ITERNAL_automaton_destroy (dfa); | 136 | REGEX_INTERNAL_automaton_destroy (dfa); |
137 | 137 | ||
138 | if (0 != regcomp (&rx, canonical_regex, REG_EXTENDED)) | 138 | if (0 != regcomp (&rx, canonical_regex, REG_EXTENDED)) |
139 | { | 139 | { |
@@ -193,7 +193,7 @@ error: | |||
193 | * @return 0 on successfull, non 0 otherwise | 193 | * @return 0 on successfull, non 0 otherwise |
194 | */ | 194 | */ |
195 | int | 195 | int |
196 | test_automaton (struct REGEX_ITERNAL_Automaton *a, regex_t * rx, | 196 | test_automaton (struct REGEX_INTERNAL_Automaton *a, regex_t * rx, |
197 | struct Regex_String_Pair *rxstr) | 197 | struct Regex_String_Pair *rxstr) |
198 | { | 198 | { |
199 | int result; | 199 | int result; |
@@ -213,7 +213,7 @@ test_automaton (struct REGEX_ITERNAL_Automaton *a, regex_t * rx, | |||
213 | 213 | ||
214 | for (i = 0; i < rxstr->string_count; i++) | 214 | for (i = 0; i < rxstr->string_count; i++) |
215 | { | 215 | { |
216 | eval = REGEX_ITERNAL_eval (a, rxstr->strings[i]); | 216 | eval = REGEX_INTERNAL_eval (a, rxstr->strings[i]); |
217 | eval_check = regexec (rx, rxstr->strings[i], 1, matchptr, 0); | 217 | eval_check = regexec (rx, rxstr->strings[i], 1, matchptr, 0); |
218 | 218 | ||
219 | /* We only want to match the whole string, because that's what our DFA does, | 219 | /* We only want to match the whole string, because that's what our DFA does, |
@@ -234,7 +234,7 @@ test_automaton (struct REGEX_ITERNAL_Automaton *a, regex_t * rx, | |||
234 | "string: %s\nexpected result: %i\n" | 234 | "string: %s\nexpected result: %i\n" |
235 | "gnunet regex: %i\nglibc regex: %i\nglibc error: %s\n" | 235 | "gnunet regex: %i\nglibc regex: %i\nglibc error: %s\n" |
236 | "rm_so: %i\nrm_eo: %i\n\n", rxstr->regex, | 236 | "rm_so: %i\nrm_eo: %i\n\n", rxstr->regex, |
237 | REGEX_ITERNAL_get_canonical_regex (a), rxstr->strings[i], | 237 | REGEX_INTERNAL_get_canonical_regex (a), rxstr->strings[i], |
238 | rxstr->expected_results[i], eval, eval_check, error, | 238 | rxstr->expected_results[i], eval, eval_check, error, |
239 | matchptr[0].rm_so, matchptr[0].rm_eo); | 239 | matchptr[0].rm_so, matchptr[0].rm_eo); |
240 | } | 240 | } |
@@ -247,7 +247,7 @@ main (int argc, char *argv[]) | |||
247 | { | 247 | { |
248 | GNUNET_log_setup ("test-regex", "WARNING", NULL); | 248 | GNUNET_log_setup ("test-regex", "WARNING", NULL); |
249 | 249 | ||
250 | struct REGEX_ITERNAL_Automaton *a; | 250 | struct REGEX_INTERNAL_Automaton *a; |
251 | regex_t rx; | 251 | regex_t rx; |
252 | int i; | 252 | int i; |
253 | int check_nfa; | 253 | int check_nfa; |
@@ -337,19 +337,19 @@ main (int argc, char *argv[]) | |||
337 | } | 337 | } |
338 | 338 | ||
339 | /* NFA test */ | 339 | /* NFA test */ |
340 | a = REGEX_ITERNAL_construct_nfa (rxstr[i].regex, strlen (rxstr[i].regex)); | 340 | a = REGEX_INTERNAL_construct_nfa (rxstr[i].regex, strlen (rxstr[i].regex)); |
341 | check_nfa += test_automaton (a, &rx, &rxstr[i]); | 341 | check_nfa += test_automaton (a, &rx, &rxstr[i]); |
342 | REGEX_ITERNAL_automaton_destroy (a); | 342 | REGEX_INTERNAL_automaton_destroy (a); |
343 | 343 | ||
344 | /* DFA test */ | 344 | /* DFA test */ |
345 | a = REGEX_ITERNAL_construct_dfa (rxstr[i].regex, strlen (rxstr[i].regex), 0); | 345 | a = REGEX_INTERNAL_construct_dfa (rxstr[i].regex, strlen (rxstr[i].regex), 0); |
346 | check_dfa += test_automaton (a, &rx, &rxstr[i]); | 346 | check_dfa += test_automaton (a, &rx, &rxstr[i]); |
347 | check_proof = GNUNET_strdup (REGEX_ITERNAL_get_canonical_regex (a)); | 347 | check_proof = GNUNET_strdup (REGEX_INTERNAL_get_canonical_regex (a)); |
348 | REGEX_ITERNAL_automaton_destroy (a); | 348 | REGEX_INTERNAL_automaton_destroy (a); |
349 | 349 | ||
350 | a = REGEX_ITERNAL_construct_dfa (check_proof, strlen (check_proof), 0); | 350 | a = REGEX_INTERNAL_construct_dfa (check_proof, strlen (check_proof), 0); |
351 | check_dfa += test_automaton (a, &rx, &rxstr[i]); | 351 | check_dfa += test_automaton (a, &rx, &rxstr[i]); |
352 | REGEX_ITERNAL_automaton_destroy (a); | 352 | REGEX_INTERNAL_automaton_destroy (a); |
353 | if (0 != check_dfa) | 353 | if (0 != check_dfa) |
354 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "check_proof: %s\n", check_proof); | 354 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "check_proof: %s\n", check_proof); |
355 | GNUNET_free_non_null (check_proof); | 355 | GNUNET_free_non_null (check_proof); |
diff --git a/src/regex/test_regex_graph_api.c b/src/regex/test_regex_graph_api.c index a0d44fb2f..cc4370c85 100644 --- a/src/regex/test_regex_graph_api.c +++ b/src/regex/test_regex_graph_api.c | |||
@@ -74,7 +74,7 @@ int | |||
74 | main (int argc, char *argv[]) | 74 | main (int argc, char *argv[]) |
75 | { | 75 | { |
76 | int error; | 76 | int error; |
77 | struct REGEX_ITERNAL_Automaton *a; | 77 | struct REGEX_INTERNAL_Automaton *a; |
78 | unsigned int i; | 78 | unsigned int i; |
79 | const char *filename = "test_graph.dot"; | 79 | const char *filename = "test_graph.dot"; |
80 | 80 | ||
@@ -98,58 +98,58 @@ main (int argc, char *argv[]) | |||
98 | for (i = 0; i < 12; i++) | 98 | for (i = 0; i < 12; i++) |
99 | { | 99 | { |
100 | /* Check NFA graph creation */ | 100 | /* Check NFA graph creation */ |
101 | a = REGEX_ITERNAL_construct_nfa (regex[i], strlen (regex[i])); | 101 | a = REGEX_INTERNAL_construct_nfa (regex[i], strlen (regex[i])); |
102 | REGEX_ITERNAL_automaton_save_graph (a, filename, REGEX_ITERNAL_GRAPH_DEFAULT); | 102 | REGEX_TEST_automaton_save_graph (a, filename, REGEX_TEST_GRAPH_DEFAULT); |
103 | REGEX_ITERNAL_automaton_destroy (a); | 103 | REGEX_INTERNAL_automaton_destroy (a); |
104 | error += filecheck (filename); | 104 | error += filecheck (filename); |
105 | 105 | ||
106 | a = REGEX_ITERNAL_construct_nfa (regex[i], strlen (regex[i])); | 106 | a = REGEX_INTERNAL_construct_nfa (regex[i], strlen (regex[i])); |
107 | REGEX_ITERNAL_automaton_save_graph (a, filename, | 107 | REGEX_TEST_automaton_save_graph (a, filename, |
108 | REGEX_ITERNAL_GRAPH_DEFAULT | | 108 | REGEX_TEST_GRAPH_DEFAULT | |
109 | REGEX_ITERNAL_GRAPH_VERBOSE); | 109 | REGEX_TEST_GRAPH_VERBOSE); |
110 | REGEX_ITERNAL_automaton_destroy (a); | 110 | REGEX_INTERNAL_automaton_destroy (a); |
111 | error += filecheck (filename); | 111 | error += filecheck (filename); |
112 | 112 | ||
113 | a = REGEX_ITERNAL_construct_nfa (regex[i], strlen (regex[i])); | 113 | a = REGEX_INTERNAL_construct_nfa (regex[i], strlen (regex[i])); |
114 | REGEX_ITERNAL_automaton_save_graph (a, filename, | 114 | REGEX_TEST_automaton_save_graph (a, filename, |
115 | REGEX_ITERNAL_GRAPH_DEFAULT | | 115 | REGEX_TEST_GRAPH_DEFAULT | |
116 | REGEX_ITERNAL_GRAPH_COLORING); | 116 | REGEX_TEST_GRAPH_COLORING); |
117 | REGEX_ITERNAL_automaton_destroy (a); | 117 | REGEX_INTERNAL_automaton_destroy (a); |
118 | error += filecheck (filename); | 118 | error += filecheck (filename); |
119 | 119 | ||
120 | a = REGEX_ITERNAL_construct_nfa (regex[i], strlen (regex[i])); | 120 | a = REGEX_INTERNAL_construct_nfa (regex[i], strlen (regex[i])); |
121 | REGEX_ITERNAL_automaton_save_graph (a, filename, | 121 | REGEX_TEST_automaton_save_graph (a, filename, |
122 | REGEX_ITERNAL_GRAPH_DEFAULT | | 122 | REGEX_TEST_GRAPH_DEFAULT | |
123 | REGEX_ITERNAL_GRAPH_VERBOSE | | 123 | REGEX_TEST_GRAPH_VERBOSE | |
124 | REGEX_ITERNAL_GRAPH_COLORING); | 124 | REGEX_TEST_GRAPH_COLORING); |
125 | REGEX_ITERNAL_automaton_destroy (a); | 125 | REGEX_INTERNAL_automaton_destroy (a); |
126 | error += filecheck (filename); | 126 | error += filecheck (filename); |
127 | 127 | ||
128 | 128 | ||
129 | /* Check DFA graph creation */ | 129 | /* Check DFA graph creation */ |
130 | a = REGEX_ITERNAL_construct_dfa (regex[i], strlen (regex[i]), 0); | 130 | a = REGEX_INTERNAL_construct_dfa (regex[i], strlen (regex[i]), 0); |
131 | REGEX_ITERNAL_automaton_save_graph (a, filename, REGEX_ITERNAL_GRAPH_DEFAULT); | 131 | REGEX_TEST_automaton_save_graph (a, filename, REGEX_TEST_GRAPH_DEFAULT); |
132 | REGEX_ITERNAL_automaton_destroy (a); | 132 | REGEX_INTERNAL_automaton_destroy (a); |
133 | error += filecheck (filename); | 133 | error += filecheck (filename); |
134 | 134 | ||
135 | a = REGEX_ITERNAL_construct_dfa (regex[i], strlen (regex[i]), 0); | 135 | a = REGEX_INTERNAL_construct_dfa (regex[i], strlen (regex[i]), 0); |
136 | REGEX_ITERNAL_automaton_save_graph (a, filename, | 136 | REGEX_TEST_automaton_save_graph (a, filename, |
137 | REGEX_ITERNAL_GRAPH_DEFAULT | | 137 | REGEX_TEST_GRAPH_DEFAULT | |
138 | REGEX_ITERNAL_GRAPH_VERBOSE); | 138 | REGEX_TEST_GRAPH_VERBOSE); |
139 | REGEX_ITERNAL_automaton_destroy (a); | 139 | REGEX_INTERNAL_automaton_destroy (a); |
140 | error += filecheck (filename); | 140 | error += filecheck (filename); |
141 | 141 | ||
142 | a = REGEX_ITERNAL_construct_dfa (regex[i], strlen (regex[i]), 0); | 142 | a = REGEX_INTERNAL_construct_dfa (regex[i], strlen (regex[i]), 0); |
143 | REGEX_ITERNAL_automaton_save_graph (a, filename, | 143 | REGEX_TEST_automaton_save_graph (a, filename, |
144 | REGEX_ITERNAL_GRAPH_DEFAULT | | 144 | REGEX_TEST_GRAPH_DEFAULT | |
145 | REGEX_ITERNAL_GRAPH_COLORING); | 145 | REGEX_TEST_GRAPH_COLORING); |
146 | REGEX_ITERNAL_automaton_destroy (a); | 146 | REGEX_INTERNAL_automaton_destroy (a); |
147 | error += filecheck (filename); | 147 | error += filecheck (filename); |
148 | 148 | ||
149 | 149 | ||
150 | a = REGEX_ITERNAL_construct_dfa (regex[i], strlen (regex[i]), 4); | 150 | a = REGEX_INTERNAL_construct_dfa (regex[i], strlen (regex[i]), 4); |
151 | REGEX_ITERNAL_automaton_save_graph (a, filename, REGEX_ITERNAL_GRAPH_DEFAULT); | 151 | REGEX_TEST_automaton_save_graph (a, filename, REGEX_TEST_GRAPH_DEFAULT); |
152 | REGEX_ITERNAL_automaton_destroy (a); | 152 | REGEX_INTERNAL_automaton_destroy (a); |
153 | error += filecheck (filename); | 153 | error += filecheck (filename); |
154 | 154 | ||
155 | } | 155 | } |
diff --git a/src/regex/test_regex_iterate_api.c b/src/regex/test_regex_iterate_api.c index dd6c09347..cf7ee2298 100644 --- a/src/regex/test_regex_iterate_api.c +++ b/src/regex/test_regex_iterate_api.c | |||
@@ -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 REGEX_ITERNAL_ITERATE_SAVE_DEBUG_GRAPH GNUNET_NO | 39 | #define REGEX_INTERNAL_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 REGEX_ITERNAL_Edge *edges) | 64 | const struct REGEX_INTERNAL_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 != REGEX_ITERNAL_check_proof (proof, key)) | 104 | if (GNUNET_OK != REGEX_INTERNAL_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 REGEX_ITERNAL_Automaton *dfa; | 120 | struct REGEX_INTERNAL_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 == REGEX_ITERNAL_ITERATE_SAVE_DEBUG_GRAPH) | 164 | if (GNUNET_YES == REGEX_INTERNAL_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 | REGEX_ITERNAL_construct_dfa (rxstr[i].regex, strlen (rxstr[i].regex), 0); | 194 | REGEX_INTERNAL_construct_dfa (rxstr[i].regex, strlen (rxstr[i].regex), 0); |
195 | REGEX_ITERNAL_iterate_all_edges (dfa, key_iterator, &ctx); | 195 | REGEX_INTERNAL_iterate_all_edges (dfa, key_iterator, &ctx); |
196 | num_transitions = | 196 | num_transitions = |
197 | REGEX_ITERNAL_get_transition_count (dfa) - dfa->start->transition_count; | 197 | REGEX_INTERNAL_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 | REGEX_ITERNAL_automaton_destroy (dfa); | 221 | REGEX_INTERNAL_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 | REGEX_ITERNAL_construct_dfa (rxstr[i].regex, strlen (rxstr[i].regex), 0); | 241 | REGEX_INTERNAL_construct_dfa (rxstr[i].regex, strlen (rxstr[i].regex), 0); |
242 | REGEX_ITERNAL_dfa_add_multi_strides (NULL, dfa, 2); | 242 | REGEX_INTERNAL_dfa_add_multi_strides (NULL, dfa, 2); |
243 | REGEX_ITERNAL_iterate_all_edges (dfa, key_iterator, &ctx); | 243 | REGEX_INTERNAL_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 | REGEX_ITERNAL_automaton_destroy (dfa); | 252 | REGEX_INTERNAL_automaton_destroy (dfa); |
253 | } | 253 | } |
254 | 254 | ||
255 | error += ctx.error; | 255 | error += ctx.error; |
diff --git a/src/regex/test_regex_proofs.c b/src/regex/test_regex_proofs.c index d7c743c77..74f0c1615 100644 --- a/src/regex/test_regex_proofs.c +++ b/src/regex/test_regex_proofs.c | |||
@@ -43,17 +43,17 @@ static unsigned int | |||
43 | test_proof (const char *regex) | 43 | test_proof (const char *regex) |
44 | { | 44 | { |
45 | unsigned int error; | 45 | unsigned int error; |
46 | struct REGEX_ITERNAL_Automaton *dfa; | 46 | struct REGEX_INTERNAL_Automaton *dfa; |
47 | char *c_rx1; | 47 | char *c_rx1; |
48 | const char *c_rx2; | 48 | const char *c_rx2; |
49 | 49 | ||
50 | dfa = REGEX_ITERNAL_construct_dfa (regex, strlen (regex), 1); | 50 | dfa = REGEX_INTERNAL_construct_dfa (regex, strlen (regex), 1); |
51 | GNUNET_assert (NULL != dfa); | 51 | GNUNET_assert (NULL != dfa); |
52 | c_rx1 = GNUNET_strdup (REGEX_ITERNAL_get_canonical_regex (dfa)); | 52 | c_rx1 = GNUNET_strdup (REGEX_INTERNAL_get_canonical_regex (dfa)); |
53 | REGEX_ITERNAL_automaton_destroy (dfa); | 53 | REGEX_INTERNAL_automaton_destroy (dfa); |
54 | dfa = REGEX_ITERNAL_construct_dfa (c_rx1, strlen (c_rx1), 1); | 54 | dfa = REGEX_INTERNAL_construct_dfa (c_rx1, strlen (c_rx1), 1); |
55 | GNUNET_assert (NULL != dfa); | 55 | GNUNET_assert (NULL != dfa); |
56 | c_rx2 = REGEX_ITERNAL_get_canonical_regex (dfa); | 56 | c_rx2 = REGEX_INTERNAL_get_canonical_regex (dfa); |
57 | 57 | ||
58 | error = (0 == strcmp (c_rx1, c_rx2)) ? 0 : 1; | 58 | error = (0 == strcmp (c_rx1, c_rx2)) ? 0 : 1; |
59 | 59 | ||
@@ -65,7 +65,7 @@ test_proof (const char *regex) | |||
65 | } | 65 | } |
66 | 66 | ||
67 | GNUNET_free (c_rx1); | 67 | GNUNET_free (c_rx1); |
68 | REGEX_ITERNAL_automaton_destroy (dfa); | 68 | REGEX_INTERNAL_automaton_destroy (dfa); |
69 | 69 | ||
70 | return error; | 70 | return error; |
71 | } | 71 | } |
@@ -91,7 +91,7 @@ test_proofs_random (unsigned int count, size_t rx_length) | |||
91 | 91 | ||
92 | for (i = 0; i < count; i++) | 92 | for (i = 0; i < count; i++) |
93 | { | 93 | { |
94 | rand_rx = REGEX_ITERNAL_generate_random_regex (rx_length, NULL); | 94 | rand_rx = REGEX_TEST_generate_random_regex (rx_length, NULL); |
95 | failures += test_proof (rand_rx); | 95 | failures += test_proof (rand_rx); |
96 | GNUNET_free (rand_rx); | 96 | GNUNET_free (rand_rx); |
97 | } | 97 | } |
@@ -124,20 +124,20 @@ test_proofs_static () | |||
124 | 124 | ||
125 | const char *canon_rx1; | 125 | const char *canon_rx1; |
126 | const char *canon_rx2; | 126 | const char *canon_rx2; |
127 | struct REGEX_ITERNAL_Automaton *dfa1; | 127 | struct REGEX_INTERNAL_Automaton *dfa1; |
128 | struct REGEX_ITERNAL_Automaton *dfa2; | 128 | struct REGEX_INTERNAL_Automaton *dfa2; |
129 | 129 | ||
130 | error = 0; | 130 | error = 0; |
131 | 131 | ||
132 | for (i = 0; i < 8; i += 2) | 132 | for (i = 0; i < 8; i += 2) |
133 | { | 133 | { |
134 | dfa1 = REGEX_ITERNAL_construct_dfa (regex[i], strlen (regex[i]), 1); | 134 | dfa1 = REGEX_INTERNAL_construct_dfa (regex[i], strlen (regex[i]), 1); |
135 | dfa2 = REGEX_ITERNAL_construct_dfa (regex[i + 1], strlen (regex[i + 1]), 1); | 135 | dfa2 = REGEX_INTERNAL_construct_dfa (regex[i + 1], strlen (regex[i + 1]), 1); |
136 | GNUNET_assert (NULL != dfa1); | 136 | GNUNET_assert (NULL != dfa1); |
137 | GNUNET_assert (NULL != dfa2); | 137 | GNUNET_assert (NULL != dfa2); |
138 | 138 | ||
139 | canon_rx1 = REGEX_ITERNAL_get_canonical_regex (dfa1); | 139 | canon_rx1 = REGEX_INTERNAL_get_canonical_regex (dfa1); |
140 | canon_rx2 = REGEX_ITERNAL_get_canonical_regex (dfa2); | 140 | canon_rx2 = REGEX_INTERNAL_get_canonical_regex (dfa2); |
141 | 141 | ||
142 | error += (0 == strcmp (canon_rx1, canon_rx2)) ? 0 : 1; | 142 | error += (0 == strcmp (canon_rx1, canon_rx2)) ? 0 : 1; |
143 | 143 | ||
@@ -148,8 +148,8 @@ test_proofs_static () | |||
148 | regex[i], canon_rx1, regex[i + 1], canon_rx2); | 148 | regex[i], canon_rx1, regex[i + 1], canon_rx2); |
149 | } | 149 | } |
150 | 150 | ||
151 | REGEX_ITERNAL_automaton_destroy (dfa1); | 151 | REGEX_INTERNAL_automaton_destroy (dfa1); |
152 | REGEX_ITERNAL_automaton_destroy (dfa2); | 152 | REGEX_INTERNAL_automaton_destroy (dfa2); |
153 | } | 153 | } |
154 | 154 | ||
155 | return error; | 155 | return error; |