diff options
-rw-r--r-- | src/regex/perf-regex.c | 7 | ||||
-rw-r--r-- | src/regex/regex.c | 10 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/regex/perf-regex.c b/src/regex/perf-regex.c index 18c51987d..15ca1690e 100644 --- a/src/regex/perf-regex.c +++ b/src/regex/perf-regex.c | |||
@@ -51,6 +51,7 @@ main (int argc, char *const *argv) | |||
51 | char *buffer; | 51 | char *buffer; |
52 | char *regex; | 52 | char *regex; |
53 | unsigned int nr; | 53 | unsigned int nr; |
54 | unsigned int i; | ||
54 | int compression; | 55 | int compression; |
55 | long size; | 56 | long size; |
56 | size_t len; | 57 | size_t len; |
@@ -112,12 +113,16 @@ main (int argc, char *const *argv) | |||
112 | 113 | ||
113 | GNUNET_asprintf (®ex, "GNVPN-0001-PAD(%s)(0|1)*", buffer); | 114 | GNUNET_asprintf (®ex, "GNVPN-0001-PAD(%s)(0|1)*", buffer); |
114 | 115 | ||
115 | // fprintf (stderr, "Combined regex:\n%s\n", regex); | 116 | fprintf (stderr, "Combined regex:\n%s\n", regex); |
116 | // return 0; | 117 | // return 0; |
117 | 118 | ||
118 | compression = atoi (argv[2]); | 119 | compression = atoi (argv[2]); |
119 | dfa = GNUNET_REGEX_construct_dfa (regex, size, compression); | 120 | dfa = GNUNET_REGEX_construct_dfa (regex, size, compression); |
120 | GNUNET_REGEX_automaton_destroy (dfa); | 121 | GNUNET_REGEX_automaton_destroy (dfa); |
122 | GNUNET_free (buffer); | ||
123 | for (i=0;i<nr;i++) | ||
124 | GNUNET_free (regexes[i]); | ||
125 | GNUNET_array_grow (regexes, nr, 0); | ||
121 | return 0; | 126 | return 0; |
122 | } | 127 | } |
123 | 128 | ||
diff --git a/src/regex/regex.c b/src/regex/regex.c index 839b425bf..0a2671fa0 100644 --- a/src/regex/regex.c +++ b/src/regex/regex.c | |||
@@ -3703,18 +3703,20 @@ GNUNET_REGEX_combine (char * const regexes[]) | |||
3703 | unsigned int i; | 3703 | unsigned int i; |
3704 | char *combined; | 3704 | char *combined; |
3705 | const char *current; | 3705 | const char *current; |
3706 | struct RegexCombineCtx *ctx; | 3706 | struct RegexCombineCtx ctx; |
3707 | 3707 | ||
3708 | ctx = GNUNET_malloc (sizeof (struct RegexCombineCtx)); | 3708 | memset (&ctx, 0, sizeof (struct RegexCombineCtx)); |
3709 | for (i = 0; regexes[i]; i++) | 3709 | for (i = 0; regexes[i]; i++) |
3710 | { | 3710 | { |
3711 | current = regexes[i]; | 3711 | current = regexes[i]; |
3712 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Regex %u: %s\n", i, current); | 3712 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Regex %u: %s\n", i, current); |
3713 | regex_add (ctx, current); | 3713 | regex_add (&ctx, current); |
3714 | } | 3714 | } |
3715 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\nCombining...\n"); | 3715 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\nCombining...\n"); |
3716 | 3716 | ||
3717 | combined = regex_combine (ctx); | 3717 | combined = regex_combine (&ctx); |
3718 | 3718 | ||
3719 | return combined; | 3719 | return combined; |
3720 | } | 3720 | } |
3721 | |||
3722 | /* end of regex.c */ | ||