diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-02-05 17:49:08 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-02-05 17:49:08 +0000 |
commit | 4800ae7a78b64bd6f338f9737dbeeaf8430e6f5b (patch) | |
tree | 213f7974f7696ae6588f042764b47b8e44a7278b /src | |
parent | 9a749a0574a9e9c36e59ed9924cb83df0e359121 (diff) | |
download | gnunet-4800ae7a78b64bd6f338f9737dbeeaf8430e6f5b.tar.gz gnunet-4800ae7a78b64bd6f338f9737dbeeaf8430e6f5b.zip |
- doc, fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/regex/regex_test_lib.c | 25 |
1 files changed, 24 insertions, 1 deletions
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 @@ | |||
28 | #include "platform.h" | 28 | #include "platform.h" |
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | 30 | ||
31 | |||
32 | /** | ||
33 | * Struct to hold the tree formed by prefix-combining the regexes. | ||
34 | */ | ||
31 | struct RegexCombineCtx { | 35 | struct RegexCombineCtx { |
36 | |||
37 | /** | ||
38 | * Next node with same prefix but different token. | ||
39 | */ | ||
32 | struct RegexCombineCtx *next; | 40 | struct RegexCombineCtx *next; |
41 | |||
42 | /** | ||
43 | * Prev node with same prefix but different token. | ||
44 | */ | ||
33 | struct RegexCombineCtx *prev; | 45 | struct RegexCombineCtx *prev; |
34 | 46 | ||
47 | /** | ||
48 | * First child node with same prefix and token. | ||
49 | */ | ||
35 | struct RegexCombineCtx *head; | 50 | struct RegexCombineCtx *head; |
51 | |||
52 | /** | ||
53 | * Last child node. | ||
54 | */ | ||
36 | struct RegexCombineCtx *tail; | 55 | struct RegexCombineCtx *tail; |
37 | 56 | ||
57 | /** | ||
58 | * Token. | ||
59 | */ | ||
38 | char *s; | 60 | char *s; |
39 | }; | 61 | }; |
40 | 62 | ||
@@ -258,10 +280,11 @@ GNUNET_REGEX_read_from_file (const char *filename) | |||
258 | else | 280 | else |
259 | { | 281 | { |
260 | len -= 6; | 282 | len -= 6; |
261 | buffer[len] = '\0'; | 283 | regex[len] = '\0'; |
262 | } | 284 | } |
263 | regex = GNUNET_realloc (regex, len + 1); | 285 | regex = GNUNET_realloc (regex, len + 1); |
264 | GNUNET_array_grow (regexes, nr, nr + 1); | 286 | GNUNET_array_grow (regexes, nr, nr + 1); |
287 | GNUNET_assert (NULL == regexes[nr - 2]); | ||
265 | regexes[nr - 2] = regex; | 288 | regexes[nr - 2] = regex; |
266 | regexes[nr - 1] = NULL; | 289 | regexes[nr - 1] = NULL; |
267 | regex = NULL; | 290 | regex = NULL; |