From a589b87d6cc07b4da4712b4ec88f0bd458da0977 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Fri, 25 Apr 2025 12:14:31 +0200 Subject: [PATCH] Remove unused parameters --- lib/perfdata/elasticsearchwriter.cpp | 28 ++++++++++++-------------- lib/perfdata/elasticsearchwriter.hpp | 14 ++++++------- lib/perfdata/gelfwriter.cpp | 30 +++++++++++++--------------- lib/perfdata/gelfwriter.hpp | 14 ++++++------- 4 files changed, 39 insertions(+), 47 deletions(-) diff --git a/lib/perfdata/elasticsearchwriter.cpp b/lib/perfdata/elasticsearchwriter.cpp index 39e411813..ed4381931 100644 --- a/lib/perfdata/elasticsearchwriter.cpp +++ b/lib/perfdata/elasticsearchwriter.cpp @@ -101,13 +101,13 @@ void ElasticsearchWriter::Resume() CheckResultHandler(checkable, cr); }); m_HandleStateChanges = Checkable::OnStateChange.connect([this](const Checkable::Ptr& checkable, - const CheckResult::Ptr& cr, StateType type, const MessageOrigin::Ptr&) { - StateChangeHandler(checkable, cr, type); + const CheckResult::Ptr& cr, StateType, const MessageOrigin::Ptr&) { + StateChangeHandler(checkable, cr); }); - m_HandleNotifications = Checkable::OnNotificationSentToAllUsers.connect([this](const Notification::Ptr& notification, + m_HandleNotifications = Checkable::OnNotificationSentToAllUsers.connect([this](const Notification::Ptr&, const Checkable::Ptr& checkable, const std::set& users, const NotificationType& type, const CheckResult::Ptr& cr, const String& author, const String& text, const MessageOrigin::Ptr&) { - NotificationSentToAllUsersHandler(notification, checkable, users, type, cr, author, text); + NotificationSentToAllUsersHandler(checkable, users, type, cr, author, text); }); } @@ -280,15 +280,15 @@ void ElasticsearchWriter::InternalCheckResultHandler(const Checkable::Ptr& check Enqueue(checkable, "checkresult", fields, cr->GetExecutionEnd()); } -void ElasticsearchWriter::StateChangeHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type) +void ElasticsearchWriter::StateChangeHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr) { if (IsPaused()) return; - m_WorkQueue.Enqueue([this, checkable, cr, type]() { StateChangeHandlerInternal(checkable, cr, type); }); + m_WorkQueue.Enqueue([this, checkable, cr]() { StateChangeHandlerInternal(checkable, cr); }); } -void ElasticsearchWriter::StateChangeHandlerInternal(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type) +void ElasticsearchWriter::StateChangeHandlerInternal(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr) { AssertOnWorkQueue(); @@ -323,21 +323,19 @@ void ElasticsearchWriter::StateChangeHandlerInternal(const Checkable::Ptr& check Enqueue(checkable, "statechange", fields, cr->GetExecutionEnd()); } -void ElasticsearchWriter::NotificationSentToAllUsersHandler(const Notification::Ptr& notification, - const Checkable::Ptr& checkable, const std::set& users, NotificationType type, - const CheckResult::Ptr& cr, const String& author, const String& text) +void ElasticsearchWriter::NotificationSentToAllUsersHandler(const Checkable::Ptr& checkable, const std::set& users, + NotificationType type, const CheckResult::Ptr& cr, const String& author, const String& text) { if (IsPaused()) return; - m_WorkQueue.Enqueue([this, notification, checkable, users, type, cr, author, text]() { - NotificationSentToAllUsersHandlerInternal(notification, checkable, users, type, cr, author, text); + m_WorkQueue.Enqueue([this, checkable, users, type, cr, author, text]() { + NotificationSentToAllUsersHandlerInternal(checkable, users, type, cr, author, text); }); } -void ElasticsearchWriter::NotificationSentToAllUsersHandlerInternal(const Notification::Ptr& notification, - const Checkable::Ptr& checkable, const std::set& users, NotificationType type, - const CheckResult::Ptr& cr, const String& author, const String& text) +void ElasticsearchWriter::NotificationSentToAllUsersHandlerInternal(const Checkable::Ptr& checkable, const std::set& users, + NotificationType type, const CheckResult::Ptr& cr, const String& author, const String& text) { AssertOnWorkQueue(); diff --git a/lib/perfdata/elasticsearchwriter.hpp b/lib/perfdata/elasticsearchwriter.hpp index 9ecd0fd76..1f5eb60bf 100644 --- a/lib/perfdata/elasticsearchwriter.hpp +++ b/lib/perfdata/elasticsearchwriter.hpp @@ -42,16 +42,14 @@ private: void AddCheckResult(const Dictionary::Ptr& fields, const Checkable::Ptr& checkable, const CheckResult::Ptr& cr); void AddTemplateTags(const Dictionary::Ptr& fields, const Checkable::Ptr& checkable, const CheckResult::Ptr& cr); - void StateChangeHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type); - void StateChangeHandlerInternal(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type); + void StateChangeHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr); + void StateChangeHandlerInternal(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr); void CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr); void InternalCheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr); - void NotificationSentToAllUsersHandler(const Notification::Ptr& notification, - const Checkable::Ptr& checkable, const std::set& users, NotificationType type, - const CheckResult::Ptr& cr, const String& author, const String& text); - void NotificationSentToAllUsersHandlerInternal(const Notification::Ptr& notification, - const Checkable::Ptr& checkable, const std::set& users, NotificationType type, - const CheckResult::Ptr& cr, const String& author, const String& text); + void NotificationSentToAllUsersHandler(const Checkable::Ptr& checkable, const std::set& users, + NotificationType type, const CheckResult::Ptr& cr, const String& author, const String& text); + void NotificationSentToAllUsersHandlerInternal(const Checkable::Ptr& checkable, const std::set& users, + NotificationType type, const CheckResult::Ptr& cr, const String& author, const String& text); void Enqueue(const Checkable::Ptr& checkable, const String& type, const Dictionary::Ptr& fields, double ts); diff --git a/lib/perfdata/gelfwriter.cpp b/lib/perfdata/gelfwriter.cpp index 35541ac60..5f7ae059b 100644 --- a/lib/perfdata/gelfwriter.cpp +++ b/lib/perfdata/gelfwriter.cpp @@ -94,14 +94,14 @@ void GelfWriter::Resume() const CheckResult::Ptr& cr, const MessageOrigin::Ptr&) { CheckResultHandler(checkable, cr); }); - m_HandleNotifications = Checkable::OnNotificationSentToUser.connect([this](const Notification::Ptr& notification, - const Checkable::Ptr& checkable, const User::Ptr& user, const NotificationType& type, const CheckResult::Ptr& cr, + m_HandleNotifications = Checkable::OnNotificationSentToUser.connect([this](const Notification::Ptr&, + const Checkable::Ptr& checkable, const User::Ptr&, const NotificationType& type, const CheckResult::Ptr& cr, const String& author, const String& commentText, const String& commandName, const MessageOrigin::Ptr&) { - NotificationToUserHandler(notification, checkable, user, type, cr, author, commentText, commandName); + NotificationToUserHandler(checkable, type, cr, author, commentText, commandName); }); m_HandleStateChanges = Checkable::OnStateChange.connect([this](const Checkable::Ptr& checkable, - const CheckResult::Ptr& cr, StateType type, const MessageOrigin::Ptr&) { - StateChangeHandler(checkable, cr, type); + const CheckResult::Ptr& cr, StateType, const MessageOrigin::Ptr&) { + StateChangeHandler(checkable, cr); }); } @@ -362,21 +362,19 @@ void GelfWriter::CheckResultHandlerInternal(const Checkable::Ptr& checkable, con SendLogMessage(checkable, ComposeGelfMessage(fields, GetSource(), cr->GetExecutionEnd())); } -void GelfWriter::NotificationToUserHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable, - const User::Ptr& user, NotificationType notificationType, CheckResult::Ptr const& cr, - const String& author, const String& commentText, const String& commandName) +void GelfWriter::NotificationToUserHandler(const Checkable::Ptr& checkable, NotificationType notificationType, + CheckResult::Ptr const& cr, const String& author, const String& commentText, const String& commandName) { if (IsPaused()) return; - m_WorkQueue.Enqueue([this, notification, checkable, user, notificationType, cr, author, commentText, commandName]() { - NotificationToUserHandlerInternal(notification, checkable, user, notificationType, cr, author, commentText, commandName); + m_WorkQueue.Enqueue([this, checkable, notificationType, cr, author, commentText, commandName]() { + NotificationToUserHandlerInternal(checkable, notificationType, cr, author, commentText, commandName); }); } -void GelfWriter::NotificationToUserHandlerInternal(const Notification::Ptr& notification, const Checkable::Ptr& checkable, - const User::Ptr& user, NotificationType notificationType, CheckResult::Ptr const& cr, - const String& author, const String& commentText, const String& commandName) +void GelfWriter::NotificationToUserHandlerInternal(const Checkable::Ptr& checkable, NotificationType notificationType, + CheckResult::Ptr const& cr, const String& author, const String& commentText, const String& commandName) { AssertOnWorkQueue(); @@ -428,15 +426,15 @@ void GelfWriter::NotificationToUserHandlerInternal(const Notification::Ptr& noti SendLogMessage(checkable, ComposeGelfMessage(fields, GetSource(), ts)); } -void GelfWriter::StateChangeHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type) +void GelfWriter::StateChangeHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr) { if (IsPaused()) return; - m_WorkQueue.Enqueue([this, checkable, cr, type]() { StateChangeHandlerInternal(checkable, cr, type); }); + m_WorkQueue.Enqueue([this, checkable, cr]() { StateChangeHandlerInternal(checkable, cr); }); } -void GelfWriter::StateChangeHandlerInternal(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type) +void GelfWriter::StateChangeHandlerInternal(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr) { AssertOnWorkQueue(); diff --git a/lib/perfdata/gelfwriter.hpp b/lib/perfdata/gelfwriter.hpp index ce9ee3545..b1dc90796 100644 --- a/lib/perfdata/gelfwriter.hpp +++ b/lib/perfdata/gelfwriter.hpp @@ -41,14 +41,12 @@ private: void CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr); void CheckResultHandlerInternal(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr); - void NotificationToUserHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable, - const User::Ptr& user, NotificationType notificationType, const CheckResult::Ptr& cr, - const String& author, const String& commentText, const String& commandName); - void NotificationToUserHandlerInternal(const Notification::Ptr& notification, const Checkable::Ptr& checkable, - const User::Ptr& user, NotificationType notification_type, const CheckResult::Ptr& cr, - const String& author, const String& comment_text, const String& command_name); - void StateChangeHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type); - void StateChangeHandlerInternal(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type); + void NotificationToUserHandler(const Checkable::Ptr& checkable, NotificationType notificationType, + const CheckResult::Ptr& cr, const String& author, const String& commentText, const String& commandName); + void NotificationToUserHandlerInternal(const Checkable::Ptr& checkable, NotificationType notification_type, + const CheckResult::Ptr& cr, const String& author, const String& comment_text, const String& command_name); + void StateChangeHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr); + void StateChangeHandlerInternal(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr); String ComposeGelfMessage(const Dictionary::Ptr& fields, const String& source, double ts); void SendLogMessage(const Checkable::Ptr& checkable, const String& gelfMessage);