From 3c2d45918f7fb77caa44e1b3781e83a7549b1010 Mon Sep 17 00:00:00 2001 From: bartpolot Date: Tue, 5 Feb 2013 17:49:08 +0000 Subject: - doc, fixes git-svn-id: https://gnunet.org/svn/gnunet@26027 140774ce-b5e7-0310-ab8b-a85725594a96 --- 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 7a11fe05ec..88a76fa27c 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; -- cgit v1.2.3-18-g5258