]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib, lib-master: Remove event.call_free
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 5 Sep 2019 08:57:20 +0000 (11:57 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 5 Sep 2019 13:29:28 +0000 (13:29 +0000)
Just call the EVENT_CALLBACK_TYPE_FREE always. Having this flag isn't
really going to affect the performance, and it might be useful in the
future to work this way.

Only the unit test was relying on call_free to be different from
id_sent_to_stats. This commit changes the unit test to check for the
END strings where necessary.

src/lib-master/stats-client.c
src/lib-master/test-event-stats.c
src/lib/lib-event-private.h
src/lib/lib-event.c

index 4fd4dbf5ddd8a07eebb93108ee7291658614b423..9c340fc2eea859ae3fd45beb91cab606433388f6 100644 (file)
@@ -175,7 +175,6 @@ stats_event_write(struct event *event, const struct failure_context *ctx,
        if (begin) {
                str_printfa(str, "BEGIN\t%"PRIu64"\t", event->id);
                event->id_sent_to_stats = TRUE;
-               event->call_free = TRUE;
        } else {
                str_append(str, "EVENT\t");
        }
index fe250c3e1610c2f7a13ce55e93ecaa172856a88e..b639187c3b2f6e404284651e549c4793d4de6469 100644 (file)
@@ -347,7 +347,8 @@ static void test_no_merging2(void)
                compare_test_stats_to(
                        "EVENT  %"PRIu64"       1       0       0"
                        "       stest-event-stats.c     %d"
-                       "       l0      0       ctest2\n", id, l));
+                       "       l0      0       ctest2\n"
+                       "END    9\n", id, l));
        test_end();
 }
 
@@ -440,7 +441,8 @@ static void test_merge_events2(void)
                        "       stest-event-stats.c     %d      l0      0"
                        "       ctest3  ctest2  ctest1  Tkey3"
                        "       10      0       Ikey2   20"
-                       "       Skey1   str1\n", id, l));
+                       "       Skey1   str1\n"
+                       "END    16\n", id, l));
        test_end();
 }
 
index dd16157ecdf53c9751bffff1dd6de485164d320f..175f19c3e57eee01962df64981b76bef2dd5da8e 100644 (file)
@@ -25,8 +25,6 @@ struct event {
        bool always_log_source:1;
        bool sending_debug_log:1;
        bool id_sent_to_stats:1;
-       /* Call callbacks with EVENT_CALLBACK_TYPE_FREE for this event. */
-       bool call_free:1;
 
 /* Fields that are exported & imported: */
        struct timeval tv_created_ioloop;
@@ -47,7 +45,7 @@ struct event {
 enum event_callback_type {
        /* Event is being sent */
        EVENT_CALLBACK_TYPE_SEND,
-       /* Event with call_free=TRUE is being freed */
+       /* Event is being freed */
        EVENT_CALLBACK_TYPE_FREE,
 };
 
index b8545a045af87e034c9bcf0331f8e25ac26428f8..108b35b30a6e19e36109bf59eaba1c902c36229a 100644 (file)
@@ -381,8 +381,7 @@ void event_unref(struct event **_event)
                return;
        i_assert(event != current_global_event);
 
-       if (event->call_free)
-               event_send_free(event);
+       event_send_free(event);
 
        if (last_passthrough_event() == event)
                event_last_passthrough = NULL;