X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fregex%2Fregex.c;h=c8b8ad3faedb680268ff3256c91ea8b868a9a449;hb=adbde8be4b6ee0a854177237391936faa8ca61c2;hp=2152167dc3944e57bb44bd7f9e97326fd4e584bd;hpb=427082beae826e666335621c1aff95524a0e964f;p=oweals%2Fgnunet.git diff --git a/src/regex/regex.c b/src/regex/regex.c index 2152167dc..c8b8ad3fa 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: