]> granicus.if.org Git - icinga2/commitdiff
Use Application::Exit to implement the exit() script function
authorGunnar Beutner <gunnar.beutner@netways.de>
Thu, 13 Nov 2014 14:56:47 +0000 (15:56 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Thu, 13 Nov 2014 14:59:40 +0000 (15:59 +0100)
lib/base/scriptutils.cpp
lib/base/scriptutils.hpp

index bc74a5a70adb32ffbe5aa3e0e9c63d7e1a6b9d3e..3cbbd55a7ed2980ea687dcf79a896449ae0848e7 100644 (file)
@@ -25,6 +25,7 @@
 #include "base/logger.hpp"
 #include "base/objectlock.hpp"
 #include "base/dynamictype.hpp"
+#include "base/application.hpp"
 #include <boost/foreach.hpp>
 #include <boost/regex.hpp>
 #include <algorithm>
@@ -39,7 +40,7 @@ REGISTER_SCRIPTFUNCTION(union, &ScriptUtils::Union);
 REGISTER_SCRIPTFUNCTION(intersection, &ScriptUtils::Intersection);
 REGISTER_SCRIPTFUNCTION(log, &ScriptUtils::Log);
 REGISTER_SCRIPTFUNCTION(range, &ScriptUtils::Range);
-REGISTER_SCRIPTFUNCTION(exit, &ScriptUtils::Exit);
+REGISTER_SCRIPTFUNCTION(exit, &Application::Exit);
 REGISTER_SCRIPTFUNCTION(typeof, &ScriptUtils::TypeOf);
 REGISTER_SCRIPTFUNCTION(keys, &ScriptUtils::Keys);
 REGISTER_SCRIPTFUNCTION(random, &Utility::Random);
@@ -179,11 +180,6 @@ Array::Ptr ScriptUtils::Range(const std::vector<Value>& arguments)
        return result;
 }
 
-void ScriptUtils::Exit(int code)
-{
-       exit(code);
-}
-
 Type::Ptr ScriptUtils::TypeOf(const Value& value)
 {
        switch (value.GetType()) {
index 1a158f8cb91891eb274eb58bf707d89f3758eae8..2dc01c03117d09bbbaceafb52673ecd1dad30ac2 100644 (file)
@@ -42,7 +42,6 @@ public:
        static Array::Ptr Intersection(const std::vector<Value>& arguments);
        static void Log(const std::vector<Value>& arguments);
        static Array::Ptr Range(const std::vector<Value>& arguments);
-       static void Exit(int code);
        static Type::Ptr TypeOf(const Value& value);
        static Array::Ptr Keys(const Dictionary::Ptr& dict);
        static DynamicObject::Ptr GetObject(const String& type, const String& name);