diff options
author | szengel <szengel@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-09-17 14:32:05 +0000 |
---|---|---|
committer | szengel <szengel@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-09-17 14:32:05 +0000 |
commit | 72dd6ef7355165b774e28d07895c7df79b0fcfbf (patch) | |
tree | 7ea369f429480af3b4e929839b5b487aa04064de /src/regex/regex.c | |
parent | cc3f097a735058a85e52f12db0e93f275da5c15e (diff) |
coverity
git-svn-id: https://gnunet.org/svn/gnunet@23863 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/regex/regex.c')
-rw-r--r-- | src/regex/regex.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/regex/regex.c b/src/regex/regex.c index 4c0f288510..d659cb949e 100644 --- a/src/regex/regex.c +++ b/src/regex/regex.c @@ -513,11 +513,12 @@ GNUNET_REGEX_automaton_traverse (const struct GNUNET_REGEX_Automaton *a, { unsigned int count; struct GNUNET_REGEX_State *s; - int marks[a->state_count]; if (NULL == a || 0 == a->state_count) return; + int marks[a->state_count]; + for (count = 0, s = a->states_head; NULL != s && count < a->state_count; s = s->next, count++) { @@ -1206,6 +1207,13 @@ automaton_create_proofs_simplify (char *R_last_ij, char *R_last_ik, static void automaton_create_proofs (struct GNUNET_REGEX_Automaton *a) { + if (NULL == a) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Could not create proofs, automaton was NULL\n"); + return; + } + unsigned int n = a->state_count; struct GNUNET_REGEX_State *states[n]; char *R_last[n][n]; @@ -1217,13 +1225,6 @@ automaton_create_proofs (struct GNUNET_REGEX_Automaton *a) unsigned int j; unsigned int k; - if (NULL == a) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Could not create proofs, automaton was NULL\n"); - return; - } - /* create depth-first numbering of the states, initializes 'state' */ GNUNET_REGEX_automaton_traverse (a, a->start, NULL, NULL, &number_states, states); |