From: Maximilian Szengel Date: Thu, 5 Jul 2012 09:46:28 +0000 (+0000) Subject: regex: fixed static analyzer warnings X-Git-Tag: initial-import-from-subversion-38251~12642 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4d54bcf5b6c10ac6b0d7e7b7d2516a626959efba;p=oweals%2Fgnunet.git regex: fixed static analyzer warnings --- diff --git a/src/regex/regex.c b/src/regex/regex.c index 1290569cc..82949934d 100644 --- a/src/regex/regex.c +++ b/src/regex/regex.c @@ -1816,8 +1816,10 @@ nfa_add_concatenation (struct GNUNET_REGEX_Context *ctx) struct GNUNET_REGEX_Automaton *new; b = ctx->stack_tail; + GNUNET_assert (NULL != b); GNUNET_CONTAINER_DLL_remove (ctx->stack_head, ctx->stack_tail, b); a = ctx->stack_tail; + GNUNET_assert (NULL != a); GNUNET_CONTAINER_DLL_remove (ctx->stack_head, ctx->stack_tail, a); state_add_transition (ctx, a->end, 0, b->start); @@ -1953,8 +1955,10 @@ nfa_add_alternation (struct GNUNET_REGEX_Context *ctx) struct GNUNET_REGEX_State *end; b = ctx->stack_tail; + GNUNET_assert (NULL != b); GNUNET_CONTAINER_DLL_remove (ctx->stack_head, ctx->stack_tail, b); a = ctx->stack_tail; + GNUNET_assert (NULL != a); GNUNET_CONTAINER_DLL_remove (ctx->stack_head, ctx->stack_tail, a); start = nfa_state_create (ctx, 0); @@ -2391,7 +2395,6 @@ evaluate_nfa (struct GNUNET_REGEX_Automaton *a, const char *string) return 0; result = 1; - strp = string; sset = nfa_closure_create (a, a->start, 0); for (strp = string; NULL != strp && *strp; strp++) diff --git a/src/regex/regex_graph.c b/src/regex/regex_graph.c index 3230ea702..eb4d61b4e 100644 --- a/src/regex/regex_graph.c +++ b/src/regex/regex_graph.c @@ -55,7 +55,11 @@ scc_tarjan_strongconnect (unsigned int *scc_counter, for (t = v->transitions_head; NULL != t; t = t->next) { w = t->to_state; - if (NULL != w && w->index < 0) + + if (NULL == w) + continue; + + if (w->index < 0) { scc_tarjan_strongconnect (scc_counter, w, index, stack, stack_size); v->lowlink = (v->lowlink > w->lowlink) ? w->lowlink : v->lowlink;