]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: event filter - Extend existing queries if context matches (event_filter_parse)
authorJosef 'Jeff' Sipek <jeff.sipek@open-xchange.com>
Wed, 21 Apr 2021 15:50:54 +0000 (11:50 -0400)
committerjeff.sipek <jeff.sipek@open-xchange.com>
Tue, 27 Apr 2021 17:46:14 +0000 (17:46 +0000)
Since there is no practical difference between a filter with one query and a
filter with multiple queries using the same context pointer, we can extend
the existing queries as long as there is a context pointer match.  This
reduces the number of queries (and filter expressions) thereby increasing
future optimization opportunities.

src/lib/event-filter.c

index 7285cecaaede791c27846b569340f8ed9766d5fd..49a25daa6560d2f535b0523cc50f89b3b06676fd 100644 (file)
@@ -173,9 +173,10 @@ int event_filter_parse(const char *str, struct event_filter *filter,
                /* success - non-NULL expression */
                i_assert(state.error == NULL);
 
-               int_query = array_append_space(&filter->queries);
-               int_query->context = NULL;
-               int_query->expr = state.output;
+               int_query = event_filter_get_or_alloc_internal_query(filter, NULL);
+
+               add_node(filter->pool, &int_query->expr, state.output,
+                        EVENT_FILTER_OP_OR);
 
                filter->named_queries_only = filter->named_queries_only && state.has_event_name;
        } else if (ret != 0) {