Browse Source

* implement flush() for filters

master
Alex 'AdUser' Z 8 years ago
parent
commit
0e5bb5ffcf
  1. 11
      src/filters/pcre.c
  2. 11
      src/filters/preg.c

11
src/filters/pcre.c

@ -182,9 +182,11 @@ match(cfg_t *cfg, const char *line, char *buf, size_t buf_size) {
} }
void void
destroy(cfg_t *cfg) { flush(cfg_t *cfg) {
f2b_regex_t *next = NULL, *r = NULL; f2b_regex_t *next = NULL, *r = NULL;
assert(cfg != NULL);
for (r = cfg->regexps; r != NULL; r = next) { for (r = cfg->regexps; r != NULL; r = next) {
next = r->next; next = r->next;
if (cfg->study) if (cfg->study)
@ -192,5 +194,12 @@ destroy(cfg_t *cfg) {
pcre_free(r->regex); pcre_free(r->regex);
free(r); free(r);
} }
}
void
destroy(cfg_t *cfg) {
assert(cfg != NULL);
flush(cfg);
free(cfg); free(cfg);
} }

11
src/filters/preg.c

@ -149,13 +149,22 @@ match(cfg_t *cfg, const char *line, char *buf, size_t buf_size) {
} }
void void
destroy(cfg_t *cfg) { flush(cfg_t *cfg) {
f2b_regex_t *next = NULL, *r = NULL; f2b_regex_t *next = NULL, *r = NULL;
assert(cfg != NULL);
for (r = cfg->regexps; r != NULL; r = next) { for (r = cfg->regexps; r != NULL; r = next) {
next = r->next; next = r->next;
regfree(&r->regex); regfree(&r->regex);
free(r); free(r);
} }
}
void
destroy(cfg_t *cfg) {
assert(cfg != NULL);
flush(cfg);
free(cfg); free(cfg);
} }

Loading…
Cancel
Save