From 35056d59662f5dde21610100c16750aaef3bcbb3 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 5 Sep 2019 11:57:20 +0300 Subject: [PATCH] lib, lib-master: Remove event.call_free 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 | 1 - src/lib-master/test-event-stats.c | 6 ++++-- src/lib/lib-event-private.h | 4 +--- src/lib/lib-event.c | 3 +-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/lib-master/stats-client.c b/src/lib-master/stats-client.c index 4fd4dbf5dd..9c340fc2ee 100644 --- a/src/lib-master/stats-client.c +++ b/src/lib-master/stats-client.c @@ -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"); } diff --git a/src/lib-master/test-event-stats.c b/src/lib-master/test-event-stats.c index fe250c3e16..b639187c3b 100644 --- a/src/lib-master/test-event-stats.c +++ b/src/lib-master/test-event-stats.c @@ -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(); } diff --git a/src/lib/lib-event-private.h b/src/lib/lib-event-private.h index dd16157ecd..175f19c3e5 100644 --- a/src/lib/lib-event-private.h +++ b/src/lib/lib-event-private.h @@ -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, }; diff --git a/src/lib/lib-event.c b/src/lib/lib-event.c index b8545a045a..108b35b30a 100644 --- a/src/lib/lib-event.c +++ b/src/lib/lib-event.c @@ -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; -- 2.47.3