aboutsummaryrefslogtreecommitdiff
path: root/src/regex/regex.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/regex/regex.c')
-rw-r--r--src/regex/regex.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/regex/regex.c b/src/regex/regex.c
index 2152167dc3..c8b8ad3fae 100644
--- a/src/regex/regex.c
+++ b/src/regex/regex.c
@@ -766,7 +766,8 @@ number_states (void *cls, unsigned int count, struct GNUNET_REGEX_State *s)
struct GNUNET_REGEX_State **states = cls;
s->proof_id = count;
- states[count] = s;
+ if (NULL != states)
+ states[count] = s;
}
@@ -1914,7 +1915,7 @@ nfa_add_question_op (struct GNUNET_REGEX_Context *ctx)
struct GNUNET_REGEX_State *end;
a = ctx->stack_tail;
-
+
if (NULL == a)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -2174,6 +2175,9 @@ GNUNET_REGEX_construct_nfa (const char *regex, const size_t len)
nfa->regex = GNUNET_strdup (regex);
+ /* create depth-first numbering of the states for pretty printing */
+ GNUNET_REGEX_automaton_traverse (nfa, &number_states, NULL);
+
return nfa;
error: