From 8e4148d33c21ea1fa641d2e0d999a4e09762b0ce Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 13 Nov 2014 15:56:47 +0100 Subject: [PATCH] Use Application::Exit to implement the exit() script function --- lib/base/scriptutils.cpp | 8 ++------ lib/base/scriptutils.hpp | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/base/scriptutils.cpp b/lib/base/scriptutils.cpp index bc74a5a70..3cbbd55a7 100644 --- a/lib/base/scriptutils.cpp +++ b/lib/base/scriptutils.cpp @@ -25,6 +25,7 @@ #include "base/logger.hpp" #include "base/objectlock.hpp" #include "base/dynamictype.hpp" +#include "base/application.hpp" #include #include #include @@ -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& arguments) return result; } -void ScriptUtils::Exit(int code) -{ - exit(code); -} - Type::Ptr ScriptUtils::TypeOf(const Value& value) { switch (value.GetType()) { diff --git a/lib/base/scriptutils.hpp b/lib/base/scriptutils.hpp index 1a158f8cb..2dc01c031 100644 --- a/lib/base/scriptutils.hpp +++ b/lib/base/scriptutils.hpp @@ -42,7 +42,6 @@ public: static Array::Ptr Intersection(const std::vector& arguments); static void Log(const std::vector& arguments); static Array::Ptr Range(const std::vector& 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);