]> granicus.if.org Git - icinga2/commitdiff
Fixed building with --disable-shared.
authorGunnar Beutner <gunnar.beutner@netways.de>
Wed, 30 Jan 2013 22:52:11 +0000 (23:52 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Wed, 30 Jan 2013 22:52:11 +0000 (23:52 +0100)
components/compat/compatcomponent.cpp
components/compat/compatcomponent.h
lib/base/scriptfunction.cpp
lib/base/scriptfunction.h

index da2209bccc53c834c1c74ff01f1a076d89482bff..3fd6fd1a229722447f768efea2046366394b734a 100644 (file)
@@ -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;
 }
index 55a1ffaa99d75a217f6bec33a6d24ed4b5e6932e..3ca730c1dbd3633066fa0cd7f95b2e2abc5ba228 100644 (file)
@@ -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;
 };
 
 }
index 56f366d2839353973a2d4dd53f3c5b4307f2b75d..dff3903c1e7284cfd0ac69eee4afa580d80e766b 100644 (file)
 
 using namespace icinga;
 
-map<String, ScriptFunction::Ptr> 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<String, ScriptFunction::Ptr>::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<Value>& ar
 {
        m_Callback(task, arguments);
 }
+
+map<String, ScriptFunction::Ptr>& ScriptFunction::GetFunctions(void)
+{
+       static map<String, ScriptFunction::Ptr> functions;
+       return functions;
+}
index 107521143ab82f57c85adbe835d82b651b063874..b7d343c4b3486d9fe458969957fc55aeadfaadac 100644 (file)
@@ -49,7 +49,7 @@ public:
 private:
        Callback m_Callback;
 
-       static map<String, ScriptFunction::Ptr> m_Functions;
+       static map<String, ScriptFunction::Ptr>& GetFunctions(void);
 };
 
 /**