From: Gunnar Beutner Date: Tue, 21 Nov 2017 13:15:29 +0000 (+0100) Subject: Replace CheckResult::StaticInitialize with a lambda function X-Git-Tag: v2.9.0~310^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=160ab21e596574c84c69cde201df3e14ca95fc8a;p=icinga2 Replace CheckResult::StaticInitialize with a lambda function --- diff --git a/lib/icinga/checkresult.cpp b/lib/icinga/checkresult.cpp index 8140db4bc..a577c4998 100644 --- a/lib/icinga/checkresult.cpp +++ b/lib/icinga/checkresult.cpp @@ -24,10 +24,8 @@ using namespace icinga; REGISTER_TYPE(CheckResult); -INITIALIZE_ONCE(&CheckResult::StaticInitialize); -void CheckResult::StaticInitialize(void) -{ +INITIALIZE_ONCE([]() { ScriptGlobal::Set("ServiceOK", ServiceOK); ScriptGlobal::Set("ServiceWarning", ServiceWarning); ScriptGlobal::Set("ServiceCritical", ServiceCritical); @@ -35,7 +33,7 @@ void CheckResult::StaticInitialize(void) ScriptGlobal::Set("HostUp", HostUp); ScriptGlobal::Set("HostDown", HostDown); -} +}) double CheckResult::CalculateExecutionTime(void) const { diff --git a/lib/icinga/checkresult.hpp b/lib/icinga/checkresult.hpp index 508d0ff7e..eeade11c8 100644 --- a/lib/icinga/checkresult.hpp +++ b/lib/icinga/checkresult.hpp @@ -38,8 +38,6 @@ public: double CalculateExecutionTime(void) const; double CalculateLatency(void) const; - - static void StaticInitialize(void); }; }