From: Josef 'Jeff' Sipek Date: Tue, 19 Jan 2021 18:40:17 +0000 (-0500) Subject: lib: event-filter - Expose internal functions to allow for unit testing X-Git-Tag: 2.3.14.rc1~91 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=586b2386e4374e16476fcc508227286dcc293485;p=thirdparty%2Fdovecot%2Fcore.git lib: event-filter - Expose internal functions to allow for unit testing We'll need these to avoid code duplication when unit testing the boolean expression evaluation logic. --- diff --git a/src/lib/event-filter-private.h b/src/lib/event-filter-private.h index 6e25bbc766..9db1d0b377 100644 --- a/src/lib/event-filter-private.h +++ b/src/lib/event-filter-private.h @@ -92,4 +92,13 @@ int event_filter_parser_parse(struct event_filter_parser_state *state); void event_filter_parser_set_extra(void *user, void *yyscanner); void event_filter_parser_error(void *scan, const char *e); +/* the following are exposed to allow for unit testing */ +bool +event_filter_query_match_eval(struct event_filter_node *node, + struct event *event, const char *source_filename, + unsigned int source_linenum, + enum event_filter_log_type log_type); +const char * +event_filter_category_from_log_type(enum event_filter_log_type log_type); + #endif diff --git a/src/lib/event-filter.c b/src/lib/event-filter.c index 40a1406be7..d9a0ac2f44 100644 --- a/src/lib/event-filter.c +++ b/src/lib/event-filter.c @@ -161,7 +161,7 @@ bool event_filter_category_to_log_type(const char *name, return FALSE; } -static const char * +const char * event_filter_category_from_log_type(enum event_filter_log_type log_type) { unsigned int i; @@ -591,7 +591,7 @@ event_filter_query_match_cmp(struct event_filter_node *node, i_unreached(); } -static bool +bool event_filter_query_match_eval(struct event_filter_node *node, struct event *event, const char *source_filename, unsigned int source_linenum,