aboutsummaryrefslogtreecommitdiff
path: root/src/regex/regex.c
diff options
context:
space:
mode:
authorszengel <szengel@140774ce-b5e7-0310-ab8b-a85725594a96>2012-07-26 13:32:08 +0000
committerszengel <szengel@140774ce-b5e7-0310-ab8b-a85725594a96>2012-07-26 13:32:08 +0000
commit970b245525f3c3df78360576e50ad2212ae0c293 (patch)
treefa1238770cd5f22669c3b82b7aaa369e653788ec /src/regex/regex.c
parent0a7200203019edf0383ebf75cc2821e6f1a8907e (diff)
- Added coloring option to graph saving.
- Fixed a bug causing NFAs not to print properly. git-svn-id: https://gnunet.org/svn/gnunet@22924 140774ce-b5e7-0310-ab8b-a85725594a96
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: