From 4800ae7a78b64bd6f338f9737dbeeaf8430e6f5b Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Tue, 5 Feb 2013 17:49:08 +0000 Subject: [PATCH] - doc, fixes --- src/regex/regex_test_lib.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/regex/regex_test_lib.c b/src/regex/regex_test_lib.c index 7a11fe05e..88a76fa27 100644 --- a/src/regex/regex_test_lib.c +++ b/src/regex/regex_test_lib.c @@ -28,13 +28,35 @@ #include "platform.h" #include "gnunet_util_lib.h" + +/** + * Struct to hold the tree formed by prefix-combining the regexes. + */ struct RegexCombineCtx { + + /** + * Next node with same prefix but different token. + */ struct RegexCombineCtx *next; + + /** + * Prev node with same prefix but different token. + */ struct RegexCombineCtx *prev; + /** + * First child node with same prefix and token. + */ struct RegexCombineCtx *head; + + /** + * Last child node. + */ struct RegexCombineCtx *tail; + /** + * Token. + */ char *s; }; @@ -258,10 +280,11 @@ GNUNET_REGEX_read_from_file (const char *filename) else { len -= 6; - buffer[len] = '\0'; + regex[len] = '\0'; } regex = GNUNET_realloc (regex, len + 1); GNUNET_array_grow (regexes, nr, nr + 1); + GNUNET_assert (NULL == regexes[nr - 2]); regexes[nr - 2] = regex; regexes[nr - 1] = NULL; regex = NULL; -- 2.25.1