From e967d931fd41fe14ff934edc7ff3f2836594a2a7 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 30 Jan 2013 23:52:11 +0100 Subject: [PATCH] Fixed building with --disable-shared. --- components/compat/compatcomponent.cpp | 10 +++------- components/compat/compatcomponent.h | 4 ---- lib/base/scriptfunction.cpp | 16 ++++++++++------ lib/base/scriptfunction.h | 2 +- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/components/compat/compatcomponent.cpp b/components/compat/compatcomponent.cpp index da2209bcc..3fd6fd1a2 100644 --- a/components/compat/compatcomponent.cpp +++ b/components/compat/compatcomponent.cpp @@ -27,10 +27,6 @@ using namespace icinga; * performance (see http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html). */ -const String CompatComponent::DefaultStatusPath = Application::GetLocalStateDir() + "/status.dat"; -const String CompatComponent::DefaultObjectsPath = Application::GetLocalStateDir() + "/objects.cache"; -const String CompatComponent::DefaultCommandPath = Application::GetLocalStateDir() + "/icinga.cmd"; - /** * Retrieves the status.dat path. * @@ -40,7 +36,7 @@ String CompatComponent::GetStatusPath(void) const { Value statusPath = GetConfig()->Get("status_path"); if (statusPath.IsEmpty()) - return DefaultStatusPath; + return Application::GetLocalStateDir() + "/status.dat"; else return statusPath; } @@ -54,7 +50,7 @@ String CompatComponent::GetObjectsPath(void) const { Value objectsPath = GetConfig()->Get("objects_path"); if (objectsPath.IsEmpty()) - return DefaultObjectsPath; + return Application::GetLocalStateDir() + "/objects.cache"; else return objectsPath; } @@ -68,7 +64,7 @@ String CompatComponent::GetCommandPath(void) const { Value commandPath = GetConfig()->Get("command_path"); if (commandPath.IsEmpty()) - return DefaultCommandPath; + return Application::GetLocalStateDir() + "/icinga.cmd"; else return commandPath; } diff --git a/components/compat/compatcomponent.h b/components/compat/compatcomponent.h index 55a1ffaa9..3ca730c1d 100644 --- a/components/compat/compatcomponent.h +++ b/components/compat/compatcomponent.h @@ -85,10 +85,6 @@ private: void DumpServiceObject(ofstream& fp, const Service::Ptr& service); void StatusTimerHandler(void); - - static const String DefaultStatusPath; - static const String DefaultObjectsPath; - static const String DefaultCommandPath; }; } diff --git a/lib/base/scriptfunction.cpp b/lib/base/scriptfunction.cpp index 56f366d28..dff3903c1 100644 --- a/lib/base/scriptfunction.cpp +++ b/lib/base/scriptfunction.cpp @@ -21,29 +21,27 @@ using namespace icinga; -map ScriptFunction::m_Functions; - ScriptFunction::ScriptFunction(const Callback& function) : m_Callback(function) { } void ScriptFunction::Register(const String& name, const ScriptFunction::Ptr& function) { - m_Functions[name] = function; + GetFunctions()[name] = function; } void ScriptFunction::Unregister(const String& name) { - m_Functions.erase(name); + GetFunctions().erase(name); } ScriptFunction::Ptr ScriptFunction::GetByName(const String& name) { map::iterator it; - it = m_Functions.find(name); + it = GetFunctions().find(name); - if (it == m_Functions.end()) + if (it == GetFunctions().end()) return ScriptFunction::Ptr(); return it->second; @@ -53,3 +51,9 @@ void ScriptFunction::Invoke(const ScriptTask::Ptr& task, const vector& ar { m_Callback(task, arguments); } + +map& ScriptFunction::GetFunctions(void) +{ + static map functions; + return functions; +} diff --git a/lib/base/scriptfunction.h b/lib/base/scriptfunction.h index 107521143..b7d343c4b 100644 --- a/lib/base/scriptfunction.h +++ b/lib/base/scriptfunction.h @@ -49,7 +49,7 @@ public: private: Callback m_Callback; - static map m_Functions; + static map& GetFunctions(void); }; /**