[icinga-checkins] icinga.org: icinga2/master: Fixed building with --disable-shared.

git at icinga.org git at icinga.org
Wed Jan 30 23:52:17 CET 2013


Module: icinga2
Branch: master
Commit: e967d931fd41fe14ff934edc7ff3f2836594a2a7
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=e967d931fd41fe14ff934edc7ff3f2836594a2a7

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed Jan 30 23:52:11 2013 +0100

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 da2209b..3fd6fd1 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 55a1ffa..3ca730c 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 56f366d..dff3903 100644
--- a/lib/base/scriptfunction.cpp
+++ b/lib/base/scriptfunction.cpp
@@ -21,29 +21,27 @@
 
 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;
+}
diff --git a/lib/base/scriptfunction.h b/lib/base/scriptfunction.h
index 1075211..b7d343c 100644
--- a/lib/base/scriptfunction.h
+++ b/lib/base/scriptfunction.h
@@ -49,7 +49,7 @@ public:
 private:
 	Callback m_Callback;
 
-	static map<String, ScriptFunction::Ptr> m_Functions;
+	static map<String, ScriptFunction::Ptr>& GetFunctions(void);
 };
 
 /**





More information about the icinga-checkins mailing list