]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: event_match_field() - Avoid recursing event fields twice
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 9 Mar 2021 14:32:35 +0000 (16:32 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 27 Apr 2021 10:55:32 +0000 (10:55 +0000)
event_find_field() is already recursive.

src/lib/event-filter.c

index 685b383b6fe515005a3bf5d5570e4263aa23689b..434f7c85cf580700712222dbc072563eebbefa91 100644 (file)
@@ -525,13 +525,12 @@ event_match_field(struct event *event, const struct event_field *wanted_field,
        const struct event_field *field;
 
        /* wanted_field has the value in all available formats */
-       while ((field = event_find_field(event, wanted_field->key)) == NULL) {
-               event = event_get_parent(event);
-               if (event == NULL) {
-                       /* field="" matches nonexistent field */
-                       return wanted_field->value.str[0] == '\0';
-               }
+       field = event_find_field(event, wanted_field->key);
+       if (field == NULL) {
+               /* field="" matches nonexistent field */
+               return wanted_field->value.str[0] == '\0';
        }
+
        switch (field->value_type) {
        case EVENT_FIELD_VALUE_TYPE_STR:
                if (op != EVENT_FILTER_OP_CMP_EQ) {