Replace CheckResult::StaticInitialize with a lambda function

This commit is contained in:
Gunnar Beutner 2017-11-21 14:15:29 +01:00
parent f7b4e81ffd
commit 160ab21e59
2 changed files with 2 additions and 6 deletions

View File

@ -24,10 +24,8 @@
using namespace icinga; using namespace icinga;
REGISTER_TYPE(CheckResult); REGISTER_TYPE(CheckResult);
INITIALIZE_ONCE(&CheckResult::StaticInitialize);
void CheckResult::StaticInitialize(void) INITIALIZE_ONCE([]() {
{
ScriptGlobal::Set("ServiceOK", ServiceOK); ScriptGlobal::Set("ServiceOK", ServiceOK);
ScriptGlobal::Set("ServiceWarning", ServiceWarning); ScriptGlobal::Set("ServiceWarning", ServiceWarning);
ScriptGlobal::Set("ServiceCritical", ServiceCritical); ScriptGlobal::Set("ServiceCritical", ServiceCritical);
@ -35,7 +33,7 @@ void CheckResult::StaticInitialize(void)
ScriptGlobal::Set("HostUp", HostUp); ScriptGlobal::Set("HostUp", HostUp);
ScriptGlobal::Set("HostDown", HostDown); ScriptGlobal::Set("HostDown", HostDown);
} })
double CheckResult::CalculateExecutionTime(void) const double CheckResult::CalculateExecutionTime(void) const
{ {

View File

@ -38,8 +38,6 @@ public:
double CalculateExecutionTime(void) const; double CalculateExecutionTime(void) const;
double CalculateLatency(void) const; double CalculateLatency(void) const;
static void StaticInitialize(void);
}; };
} }