regex: fixed static analyzer warnings
authorMaximilian Szengel <gnunet@maxsz.de>
Thu, 5 Jul 2012 09:46:28 +0000 (09:46 +0000)
committerMaximilian Szengel <gnunet@maxsz.de>
Thu, 5 Jul 2012 09:46:28 +0000 (09:46 +0000)
src/regex/regex.c
src/regex/regex_graph.c

index 1290569ccd762d774e2ab7318ad858e3ad32e3db..82949934df7204d8e0d658a1fc2325d34ca01fd9 100644 (file)
@@ -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++)
index 3230ea702b37bb528c4e3d56ba301508c82068a7..eb4d61b4e9a3559c34ee7a114ffca36839bc716a 100644 (file)
@@ -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;