]> granicus.if.org Git - icinga2/commitdiff
Windows build fix.
authorGunnar Beutner <gunnar.beutner@netways.de>
Fri, 15 Mar 2013 10:51:35 +0000 (11:51 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Fri, 15 Mar 2013 10:52:10 +0000 (11:52 +0100)
lib/base/registry.h
lib/config/configcompiler.h
lib/python/pythonlanguage.cpp
tools/.gitignore [new file with mode: 0644]
tools/mkembedconfig.c

index 8bbf5882de0710b8d3c8589f2a1aeccbbe99ce54..b32721f4db4d47f27a20abf1154b28ba3ab387b9 100644 (file)
@@ -91,20 +91,14 @@ public:
                return m_Items; /* Makes a copy of the map. */
        }
 
-       static signals2::signal<void (const String&, const T&)> OnRegistered;
-       static signals2::signal<void (const String&)> OnUnregistered;
+       signals2::signal<void (const String&, const T&)> OnRegistered;
+       signals2::signal<void (const String&)> OnUnregistered;
 
 private:
        mutable boost::mutex m_Mutex;
        typename Registry<T>::ItemMap m_Items;
 };
 
-template<typename T>
-signals2::signal<void (const String&, const T&)> Registry<T>::OnRegistered;
-
-template<typename T>
-signals2::signal<void (const String&)> Registry<T>::OnUnregistered;
-
 }
 
 #endif /* REGISTRY_H */
index fcd809c2a273537ee8c50ea383510ceb3890f56d..e38bc2737602987d0971ac3ffba6659c193eb6b3 100644 (file)
@@ -89,8 +89,8 @@ public:
        }
 };
 
-#define REGISTER_CONFIG_FRAGMENT(name, fragment) \
-       static icinga::RegisterConfigFragmentHelper g_RegisterCF_ ## type(name, fragment)
+#define REGISTER_CONFIG_FRAGMENT(id, name, fragment) \
+       static icinga::RegisterConfigFragmentHelper g_RegisterCF_ ## id(name, fragment)
 
 }
 
index cff9dbbca2d3c86595911e6146bc74d3c258080b..bb3c80c9d9f4385376b806c03ac49b791740ab4f 100644 (file)
@@ -60,12 +60,12 @@ void PythonLanguage::InitializeOnce(void)
        PyEval_ReleaseLock();
 
        String name;
-       BOOST_FOREACH(tie(name, tuples::ignore), ScriptFunction::GetFunctions()) {
+       BOOST_FOREACH(tie(name, tuples::ignore), ScriptFunctionRegistry::GetInstance()->GetItems()) {
                RegisterNativeFunction(name);
        }
 
-       ScriptFunction::OnRegistered.connect(boost::bind(&PythonLanguage::RegisterNativeFunction, this, _1));
-       ScriptFunction::OnUnregistered.connect(boost::bind(&PythonLanguage::UnregisterNativeFunction, this, _1));
+       ScriptFunctionRegistry::GetInstance()->OnRegistered.connect(boost::bind(&PythonLanguage::RegisterNativeFunction, this, _1));
+       ScriptFunctionRegistry::GetInstance()->OnUnregistered.connect(boost::bind(&PythonLanguage::UnregisterNativeFunction, this, _1));
 
        m_Initialized = true;
 }
diff --git a/tools/.gitignore b/tools/.gitignore
new file mode 100644 (file)
index 0000000..5a41d48
--- /dev/null
@@ -0,0 +1 @@
+mkembedconfig
index 66488514497c2dde17eb096eddcadbb738c3fec1..e4f43c0229cb1cf0bca64bb2da4bfb58890bce7f 100644 (file)
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 
 int main(int argc, char **argv)
 {
        int cols;
        FILE *infp, *outfp;
+       int i;
 
        if (argc < 3) {
                fprintf(stderr, "Syntax: %s <in-file> <out-file>\n", argv[0]);
@@ -65,7 +67,16 @@ int main(int argc, char **argv)
                cols++;
        }
 
-       fprintf(outfp, "0\n};\n\nREGISTER_CONFIG_FRAGMENT(\"%s\", g_ConfigFragment);\n", argv[1]);
+       char id[32];
+       strncpy(id, argv[1], sizeof(id));
+       id[sizeof(id) - 1] = '\0';
+
+       for (i = 0; i < sizeof(id) - 1; i++) {
+               if ((id[i] < 'a' || id[i] > 'z') && (id[i] < 'A' || id[i] > 'Z'))
+                       id[i] = '_';
+       }
+
+       fprintf(outfp, "0\n};\n\nREGISTER_CONFIG_FRAGMENT(%s, \"%s\", g_ConfigFragment);\n", id, argv[1]);
 
        fclose(outfp);
        fclose(infp);