From 7e3cf5f461eb4fbb7581672bf0835da07c378136 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 31 Oct 2019 13:03:48 +0100 Subject: tighten formatting rules --- src/regex/gnunet-daemon-regexprofiler.c | 10 +++-- src/regex/gnunet-regex-profiler.c | 7 ++-- src/regex/gnunet-regex-simulation-profiler.c | 7 ++-- src/regex/perf-regex.c | 1 + src/regex/plugin_block_regex.c | 1 + src/regex/regex_api_announce.c | 2 +- src/regex/regex_block_lib.c | 2 +- src/regex/regex_internal.c | 62 ++++++++++++++-------------- src/regex/regex_internal.h | 1 - src/regex/regex_internal_lib.h | 1 - src/regex/regex_test_graph.c | 2 +- src/regex/regex_test_lib.c | 15 ++++--- src/regex/regex_test_lib.h | 1 - src/regex/regex_test_random.c | 4 +- src/regex/test_regex_api.c | 1 + src/regex/test_regex_eval_api.c | 18 ++++---- src/regex/test_regex_integration.c | 1 + 17 files changed, 73 insertions(+), 63 deletions(-) (limited to 'src/regex') diff --git a/src/regex/gnunet-daemon-regexprofiler.c b/src/regex/gnunet-daemon-regexprofiler.c index a23336808..fb061acc1 100644 --- a/src/regex/gnunet-daemon-regexprofiler.c +++ b/src/regex/gnunet-daemon-regexprofiler.c @@ -101,7 +101,6 @@ static unsigned int rounds = 3; static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; - /** * Task run during shutdown. * @@ -157,7 +156,7 @@ reannounce_regex (void *cls) } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Announcing regex: %s\n", regex); GNUNET_STATISTICS_update (stats_handle, "# regexes announced", 1, GNUNET_NO); - if ((NULL == announce_handle)&&(NULL != regex)) + if ((NULL == announce_handle) && (NULL != regex)) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "First time, creating regex: %s\n", @@ -196,7 +195,7 @@ announce_regex (const char *regex) { char *copy; - if ((NULL == regex)||(0 == strlen (regex))) + if ((NULL == regex) || (0 == strlen (regex))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot announce empty regex\n"); return; @@ -393,12 +392,15 @@ main (int argc, char *const *argv) /** * MINIMIZE heap size (way below 128k) since this process doesn't need much. */ -void __attribute__ ((constructor)) GNUNET_ARM_memory_init () +void __attribute__ ((constructor)) +GNUNET_ARM_memory_init () { mallopt (M_TRIM_THRESHOLD, 4 * 1024); mallopt (M_TOP_PAD, 1 * 1024); malloc_trim (0); } + + #endif diff --git a/src/regex/gnunet-regex-profiler.c b/src/regex/gnunet-regex-profiler.c index 16b7a7f0e..695d66144 100644 --- a/src/regex/gnunet-regex-profiler.c +++ b/src/regex/gnunet-regex-profiler.c @@ -417,7 +417,7 @@ do_shutdown (void *cls) { peer = &peers[peer_cnt]; - if ((GNUNET_YES != peer->search_str_matched) &&(NULL != data_file) ) + if ((GNUNET_YES != peer->search_str_matched) && (NULL != data_file) ) { prof_time = GNUNET_TIME_absolute_get_duration (peer->prof_start_time); size = @@ -650,7 +650,7 @@ stats_connect_cb (void *cls, { struct RegexPeer *peer = cls; - if ((NULL == ca_result)||(NULL != emsg)) + if ((NULL == ca_result) || (NULL != emsg)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to connect to statistics service on peer %u: %s\n", @@ -1043,7 +1043,7 @@ dht_connect_cb (void *cls, { struct RegexPeer *peer = (struct RegexPeer *) cls; - if ((NULL != emsg)||(NULL == op)||(NULL == ca_result)) + if ((NULL != emsg) || (NULL == op) || (NULL == ca_result)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "DHT connect failed: %s\n", emsg); GNUNET_assert (0); @@ -1170,6 +1170,7 @@ test_master (void *cls, GNUNET_SCHEDULER_add_delayed (search_timeout_time, &search_timed_out, NULL); } + /** * Function that will be called whenever something in the testbed changes. * diff --git a/src/regex/gnunet-regex-simulation-profiler.c b/src/regex/gnunet-regex-simulation-profiler.c index 6637bafed..9adde99bd 100644 --- a/src/regex/gnunet-regex-simulation-profiler.c +++ b/src/regex/gnunet-regex-simulation-profiler.c @@ -305,6 +305,7 @@ do_abort (void *cls) GNUNET_SCHEDULER_shutdown (); } + /** * Iterator over all states that inserts each state into the MySQL db. * @@ -369,7 +370,7 @@ regex_iterator (void *cls, return; } - if ((-1 != total) &&(total > 0) ) + if ((-1 != total) && (total > 0) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Total: %llu (%s, %s)\n", (unsigned long long) total, @@ -409,7 +410,7 @@ regex_iterator (void *cls, num_merged_states++; } - if ((GNUNET_SYSERR == result) || ((1 != result) &&(0 != result) )) + if ((GNUNET_SYSERR == result) || ((1 != result) && (0 != result) )) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error executing prepared mysql statement for edge: Affected rows: %i, expected 0 or 1!\n", @@ -433,7 +434,7 @@ regex_iterator (void *cls, stmt_handle, params_stmt); - if ((1 != result) &&(0 != result) ) + if ((1 != result) && (0 != result) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error executing prepared mysql statement for edge: Affected rows: %i, expected 0 or 1!\n", diff --git a/src/regex/perf-regex.c b/src/regex/perf-regex.c index d41887f6b..6155501f2 100644 --- a/src/regex/perf-regex.c +++ b/src/regex/perf-regex.c @@ -125,4 +125,5 @@ main (int argc, char *const *argv) return 0; } + /* end of prof-regex.c */ diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c index e8ff158dd..9c7aa9119 100644 --- a/src/regex/plugin_block_regex.c +++ b/src/regex/plugin_block_regex.c @@ -408,4 +408,5 @@ libgnunet_plugin_block_regex_done (void *cls) return NULL; } + /* end of plugin_block_regex.c */ diff --git a/src/regex/regex_api_announce.c b/src/regex/regex_api_announce.c index 318d73263..ad8a4fab9 100644 --- a/src/regex/regex_api_announce.c +++ b/src/regex/regex_api_announce.c @@ -63,7 +63,6 @@ struct GNUNET_REGEX_Announcement }; - /** * (Re)connect to the REGEX service with the given announcement @a a. * @@ -183,4 +182,5 @@ GNUNET_REGEX_announce_cancel (struct GNUNET_REGEX_Announcement *a) GNUNET_free (a); } + /* end of regex_api_announce.c */ diff --git a/src/regex/regex_block_lib.c b/src/regex/regex_block_lib.c index 2c6752e09..a309c2305 100644 --- a/src/regex/regex_block_lib.c +++ b/src/regex/regex_block_lib.c @@ -218,7 +218,7 @@ REGEX_BLOCK_check (const struct RegexBlock *block, GNUNET_break_op (0); return GNUNET_SYSERR; } - if ((NULL != query)&& + if ((NULL != query) && (0 != GNUNET_memcmp (&key, query)) ) { diff --git a/src/regex/regex_internal.c b/src/regex/regex_internal.c index 78c2de8ab..1dd4f6a97 100644 --- a/src/regex/regex_internal.c +++ b/src/regex/regex_internal.c @@ -121,7 +121,7 @@ state_add_transition (struct REGEX_INTERNAL_Context *ctx, /* Do not add duplicate state transitions */ for (t = from_state->transitions_head; NULL != t; t = t->next) { - if ((t->to_state == to_state) &&(0 == nullstrcmp (t->label, label)) && + if ((t->to_state == to_state) && (0 == nullstrcmp (t->label, label)) && (t->from_state == from_state) ) return; } @@ -162,7 +162,7 @@ static void state_remove_transition (struct REGEX_INTERNAL_State *state, struct REGEX_INTERNAL_Transition *transition) { - if ((NULL == state)||(NULL == transition)) + if ((NULL == state) || (NULL == transition)) return; if (transition->from_state != state) @@ -247,7 +247,7 @@ state_set_compare (struct REGEX_INTERNAL_StateSet *sset1, int result; unsigned int i; - if ((NULL == sset1)||(NULL == sset2)) + if ((NULL == sset1) || (NULL == sset2)) return 1; result = sset1->off - sset2->off; @@ -339,7 +339,7 @@ automaton_remove_state (struct REGEX_INTERNAL_Automaton *a, struct REGEX_INTERNAL_Transition *t_check; struct REGEX_INTERNAL_Transition *t_check_next; - if ((NULL == a)||(NULL == s)) + if ((NULL == a) || (NULL == s)) return; /* remove all transitions leading to this state */ @@ -399,7 +399,7 @@ automaton_merge_states (struct REGEX_INTERNAL_Context *ctx, is_dup = GNUNET_NO; for (t = t_check->from_state->transitions_head; NULL != t; t = t->next) { - if ((t->to_state == s1) &&(0 == strcmp (t_check->label, t->label)) ) + if ((t->to_state == s1) && (0 == strcmp (t_check->label, t->label)) ) is_dup = GNUNET_YES; } if (GNUNET_NO == is_dup) @@ -487,7 +487,7 @@ automaton_state_traverse (struct REGEX_INTERNAL_State *s, for (t = s->transitions_head; NULL != t; t = t->next) { if ((NULL == check) || - ((NULL != check) &&(GNUNET_YES == check (check_cls, s, t)) )) + ((NULL != check) && (GNUNET_YES == check (check_cls, s, t)) )) { automaton_state_traverse (t->to_state, marks, @@ -525,7 +525,7 @@ REGEX_INTERNAL_automaton_traverse (const struct REGEX_INTERNAL_Automaton *a, unsigned int count; struct REGEX_INTERNAL_State *s; - if ((NULL == a)||(0 == a->state_count)) + if ((NULL == a) || (0 == a->state_count)) return; int marks[a->state_count]; @@ -1197,9 +1197,7 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij, * R_cur_ij = R_cur_l | R_cur_r * R_cur_l == R^{(k-1)}_{ij} * R_cur_r == R^{(k-1)}_{ik} ( R^{(k-1)}_{kk} )^* R^{(k-1)}_{kj} - */ - - if ((GNUNET_YES == R_last_ij->null_flag) && + */if ((GNUNET_YES == R_last_ij->null_flag) && ((GNUNET_YES == R_last_ik->null_flag) || (GNUNET_YES == R_last_kj->null_flag))) { @@ -1283,8 +1281,7 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij, * (e|a)|(e|a)a*a = a* * (e|a)|(e|a)a*(e|a) = a* * (e|a)|(e|a)(e|a)*(e|a) = a* - */ - if (GNUNET_YES == needs_parentheses (&R_temp_ij)) + */if (GNUNET_YES == needs_parentheses (&R_temp_ij)) sb_printf1 (R_cur_r, "(%.*s)*", 3, &R_temp_ij); else sb_printf1 (R_cur_r, "%.*s*", 1, &R_temp_ij); @@ -1297,8 +1294,7 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij, * a|aa*(e|a) = a+ * a|(e|a)(e|a)*a = a+ * a|a(e|a)*(e|a) = a+ - */ - if (GNUNET_YES == needs_parentheses (&R_temp_ij)) + */if (GNUNET_YES == needs_parentheses (&R_temp_ij)) sb_printf1 (R_cur_r, "(%.*s)+", 3, &R_temp_ij); else sb_printf1 (R_cur_r, "%.*s+", 1, &R_temp_ij); @@ -1435,8 +1431,7 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij, * aa*(e|a) = a+ * a(e|a)*(e|a) = a+ * (e|a)a*a = a+ - */ - else + */else { eps_check = (has_epsilon (R_last_ik) + has_epsilon (R_last_kk) + has_epsilon (R_last_kj)); @@ -1922,7 +1917,7 @@ dfa_remove_dead_states (struct REGEX_INTERNAL_Automaton *a) dead = 1; for (t = s->transitions_head; NULL != t; t = t->next) { - if ((NULL != t->to_state) &&(t->to_state != s) ) + if ((NULL != t->to_state) && (t->to_state != s) ) { dead = 0; break; @@ -2201,7 +2196,7 @@ REGEX_INTERNAL_dfa_add_multi_strides (struct REGEX_INTERNAL_Context *regex_ctx, struct REGEX_INTERNAL_Transition *t; struct REGEX_INTERNAL_Transition *t_next; - if ((1 > stride_len)||(GNUNET_YES == dfa->is_multistrided)) + if ((1 > stride_len) || (GNUNET_YES == dfa->is_multistrided)) return; /* Compute the new transitions of given stride_len */ @@ -2226,6 +2221,7 @@ REGEX_INTERNAL_dfa_add_multi_strides (struct REGEX_INTERNAL_Context *regex_ctx, dfa->is_multistrided = GNUNET_YES; } + /** * Recursive Helper function for DFA path compression. Does DFS on the DFA graph * and adds new transitions to the given transitions DLL and marks states that @@ -2252,11 +2248,14 @@ dfa_compress_paths_helper (struct REGEX_INTERNAL_Automaton *dfa, char *new_label; - if ((NULL != label)&& - (((cur->incoming_transition_count > 1)||(GNUNET_YES == cur->accepting)|| + if ((NULL != label) && + (((cur->incoming_transition_count > 1) || (GNUNET_YES == + cur->accepting) || (GNUNET_YES == cur->marked) ) || - ((start != dfa->start)&&(max_len > 0)&&(max_len == strlen (label))) || - ((start == dfa->start)&&(GNUNET_REGEX_INITIAL_BYTES == strlen (label))))) + ((start != dfa->start) && (max_len > 0) && (max_len == strlen ( + label))) || + ((start == dfa->start) && (GNUNET_REGEX_INITIAL_BYTES == strlen ( + label))))) { t = GNUNET_new (struct REGEX_INTERNAL_Transition); t->label = GNUNET_strdup (label); @@ -2279,7 +2278,7 @@ dfa_compress_paths_helper (struct REGEX_INTERNAL_Automaton *dfa, else if (cur != start) cur->contained = GNUNET_YES; - if ((GNUNET_YES == cur->marked)&&(cur != start)) + if ((GNUNET_YES == cur->marked) && (cur != start)) return; cur->marked = GNUNET_YES; @@ -2398,7 +2397,7 @@ nfa_fragment_create (struct REGEX_INTERNAL_State *start, n->end = NULL; n->state_count = 0; - if ((NULL == start)||(NULL == end)) + if ((NULL == start) || (NULL == end)) return n; automaton_add_state (n, end); @@ -2427,7 +2426,7 @@ nfa_add_states (struct REGEX_INTERNAL_Automaton *n, { struct REGEX_INTERNAL_State *s; - if ((NULL == n)||(NULL == states_head)) + if ((NULL == n) || (NULL == states_head)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not add states\n"); return; @@ -2820,7 +2819,7 @@ REGEX_INTERNAL_construct_nfa (const char *regex, const size_t len) int atomcount; } *p; - if ((NULL == regex)||(0 == strlen (regex))||(0 == len)) + if ((NULL == regex) || (0 == strlen (regex)) || (0 == len)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not parse regex. Empty regex string provided.\n"); @@ -3009,7 +3008,7 @@ construct_dfa_states (struct REGEX_INTERNAL_Context *ctx, for (ctran = dfa_state->transitions_head; NULL != ctran; ctran = ctran->next) { - if ((NULL == ctran->label) ||(NULL != ctran->to_state) ) + if ((NULL == ctran->label) || (NULL != ctran->to_state) ) continue; nfa_closure_set_create (&tmp, nfa, &dfa_state->nfa_set, ctran->label); @@ -3173,7 +3172,7 @@ evaluate_dfa (struct REGEX_INTERNAL_Automaton *a, const char *string) s = a->start; /* If the string is empty but the starting state is accepting, we accept. */ - if (((NULL == string)||(0 == strlen (string))) && s->accepting) + if (((NULL == string) || (0 == strlen (string))) && s->accepting) return 0; for (strp = string; NULL != strp && *strp; strp += step_len) @@ -3184,7 +3183,7 @@ evaluate_dfa (struct REGEX_INTERNAL_Automaton *a, const char *string) break; } - if ((NULL != s)&& s->accepting) + if ((NULL != s) && s->accepting) return 0; return 1; @@ -3218,7 +3217,7 @@ evaluate_nfa (struct REGEX_INTERNAL_Automaton *a, const char *string) } /* If the string is empty but the starting state is accepting, we accept. */ - if (((NULL == string)||(0 == strlen (string))) && a->start->accepting) + if (((NULL == string) || (0 == strlen (string))) && a->start->accepting) return 0; result = 1; @@ -3644,7 +3643,7 @@ reachability_iterator (void *cls, /* already visited and marked */ return GNUNET_YES; - if ((GNUNET_REGEX_INITIAL_BYTES > strlen (state->proof))&& + if ((GNUNET_REGEX_INITIAL_BYTES > strlen (state->proof)) && (GNUNET_NO == state->accepting) ) /* not directly reachable */ return GNUNET_YES; @@ -3685,6 +3684,7 @@ iterate_reachables (void *cls, const struct GNUNET_HashCode *key, void *value) return GNUNET_YES; } + /** * Iterate over all edges of automaton 'a' that are reachable from a state with * a proof of at least GNUNET_REGEX_INITIAL_BYTES characters. diff --git a/src/regex/regex_internal.h b/src/regex/regex_internal.h index 1e0722136..17b038f21 100644 --- a/src/regex/regex_internal.h +++ b/src/regex/regex_internal.h @@ -446,7 +446,6 @@ REGEX_INTERNAL_dfa_add_multi_strides (struct REGEX_INTERNAL_Context *regex_ctx, const unsigned int stride_len); - #if 0 /* keep Emacsens' auto-indent happy */ { #endif diff --git a/src/regex/regex_internal_lib.h b/src/regex/regex_internal_lib.h index 531f998cc..cd955e68b 100644 --- a/src/regex/regex_internal_lib.h +++ b/src/regex/regex_internal_lib.h @@ -157,7 +157,6 @@ REGEX_INTERNAL_iterate_reachable_edges (struct REGEX_INTERNAL_Automaton *a, void *iterator_cls); - /** * Handle to store cached data about a regex announce. */ diff --git a/src/regex/regex_test_graph.c b/src/regex/regex_test_graph.c index c988b5aae..8e1e00fd4 100644 --- a/src/regex/regex_test_graph.c +++ b/src/regex/regex_test_graph.c @@ -282,7 +282,7 @@ REGEX_TEST_automaton_save_graph (struct REGEX_INTERNAL_Automaton *a, return; } - if ((NULL == filename)||(strlen (filename) < 1)) + if ((NULL == filename) || (strlen (filename) < 1)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No Filename given!"); return; diff --git a/src/regex/regex_test_lib.c b/src/regex/regex_test_lib.c index 15d6c653a..05001b5d2 100644 --- a/src/regex/regex_test_lib.c +++ b/src/regex/regex_test_lib.c @@ -72,11 +72,11 @@ c2i (char c, int size) break; case 16: - if ((c >= '0') &&(c <= '9') ) + if ((c >= '0') && (c <= '9') ) return c - '0'; - else if ((c >= 'A') &&(c <= 'F') ) + else if ((c >= 'A') && (c <= 'F') ) return c - 'A' + 10; - else if ((c >= 'a') &&(c <= 'f') ) + else if ((c >= 'a') && (c <= 'f') ) return c - 'a' + 10; else { @@ -324,6 +324,7 @@ get_longest_prefix (struct RegexCombineCtx *ctx, const char *regex) return best; } + static void regex_add_multiple (struct RegexCombineCtx *ctx, const char *regex, @@ -347,7 +348,7 @@ regex_add_multiple (struct RegexCombineCtx *ctx, count = 0; for (i = 1UL; i < l; i++) { - if ((regex[i] != '|') &&(regex[i] != ')') ) + if ((regex[i] != '|') && (regex[i] != ')') ) { count++; } @@ -361,7 +362,7 @@ regex_add_multiple (struct RegexCombineCtx *ctx, tmp[1] = '\0'; for (i = 1UL; i < l; i++) { - if ((regex[i] != '|') &&(regex[i] != ')') ) + if ((regex[i] != '|') && (regex[i] != ')') ) { tmp[0] = regex[i]; newctx = new_regex_ctx (ctx->size); @@ -375,6 +376,7 @@ regex_add_multiple (struct RegexCombineCtx *ctx, } } + /** * Add a single regex to a context, splitting the exisiting state. * @@ -482,7 +484,7 @@ regex_add (struct RegexCombineCtx *ctx, const char *regex) /* There is no prefix match, add new */ idx = c2i (regex[0], ctx->size); - if ((NULL == ctx->children[idx])&&(NULL != ctx->s)) + if ((NULL == ctx->children[idx]) && (NULL != ctx->s)) { /* this was the end before, add empty string */ newctx = new_regex_ctx (ctx->size); @@ -652,4 +654,5 @@ REGEX_TEST_free_from_file (char **regexes) GNUNET_free (regexes); } + /* end of regex_test_lib.c */ diff --git a/src/regex/regex_test_lib.h b/src/regex/regex_test_lib.h index a0ad0723a..98f60d317 100644 --- a/src/regex/regex_test_lib.h +++ b/src/regex/regex_test_lib.h @@ -147,7 +147,6 @@ REGEX_TEST_automaton_save_graph (struct REGEX_INTERNAL_Automaton *a, enum REGEX_TEST_GraphSavingOptions options); - #if 0 /* keep Emacsens' auto-indent happy */ { #endif diff --git a/src/regex/regex_test_random.c b/src/regex/regex_test_random.c index 29b5315db..02d59f5dc 100644 --- a/src/regex/regex_test_random.c +++ b/src/regex/regex_test_random.c @@ -123,8 +123,8 @@ REGEX_TEST_generate_random_regex (size_t rx_length, char *matching_str) } if ((NULL != matching_strp) && - ((current_char != '+') &&(current_char != '*') &&(current_char != - '?') && + ((current_char != '+') && (current_char != '*') && (current_char != + '?') && (current_char != '|') )) { *matching_strp = current_char; diff --git a/src/regex/test_regex_api.c b/src/regex/test_regex_api.c index eaae8c682..734fbdbf3 100644 --- a/src/regex/test_regex_api.c +++ b/src/regex/test_regex_api.c @@ -128,4 +128,5 @@ main (int argc, char *argv[]) return ok; } + /* end of test_regex_api.c */ diff --git a/src/regex/test_regex_eval_api.c b/src/regex/test_regex_eval_api.c index f6078c7ef..767571156 100644 --- a/src/regex/test_regex_eval_api.c +++ b/src/regex/test_regex_eval_api.c @@ -119,8 +119,8 @@ test_random (unsigned int rx_length, unsigned int max_str_len, /* We only want to match the whole string, because that's what our DFA does, * too. */ if ((eval_check == 0) && - ((matchptr[0].rm_so != 0) ||(matchptr[0].rm_eo != strlen ( - matching_str)) )) + ((matchptr[0].rm_so != 0) || (matchptr[0].rm_eo != strlen ( + matching_str)) )) eval_check = 1; /* Match canonical regex */ @@ -150,12 +150,12 @@ test_random (unsigned int rx_length, unsigned int max_str_len, /* We only want to match the whole string, because that's what our DFA does, * too. */ if ((eval_canonical_check == 0) && - ((matchptr[0].rm_so != 0) ||(matchptr[0].rm_eo != strlen ( - matching_str)) )) + ((matchptr[0].rm_so != 0) || (matchptr[0].rm_eo != strlen ( + matching_str)) )) eval_canonical_check = 1; /* compare results */ - if ((eval_check != eval) ||(eval_canonical != eval_canonical_check) ) + if ((eval_check != eval) || (eval_canonical != eval_canonical_check) ) { regerror (eval_check, &rx, error, sizeof error); GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -184,6 +184,7 @@ error: return -1; } + /** * Automaton test that compares the result of matching regular expression 'rx' * with the strings and expected results in 'rxstr' with the result of matching @@ -227,10 +228,10 @@ test_automaton (struct REGEX_INTERNAL_Automaton *a, regex_t *rx, (matchptr[0].rm_eo != strlen (rxstr->strings[i])) )) eval_check = 1; - if (((rxstr->expected_results[i] == match) && ((0 != eval) ||(0 != - eval_check) )) + if (((rxstr->expected_results[i] == match) && ((0 != eval) || (0 != + eval_check) )) || ((rxstr->expected_results[i] == nomatch) && - ((0 == eval) ||(0 == eval_check) ))) + ((0 == eval) || (0 == eval_check) ))) { result = 1; regerror (eval_check, rx, error, sizeof error); @@ -247,6 +248,7 @@ test_automaton (struct REGEX_INTERNAL_Automaton *a, regex_t *rx, return result; } + int main (int argc, char *argv[]) { diff --git a/src/regex/test_regex_integration.c b/src/regex/test_regex_integration.c index c7a7e38b5..2e6874e4d 100644 --- a/src/regex/test_regex_integration.c +++ b/src/regex/test_regex_integration.c @@ -208,4 +208,5 @@ main (int argc, char *argv[]) return ok; } + /* end of test_regex_integration.c */ -- cgit v1.2.3