diff --git a/lib/base/application.cpp b/lib/base/application.cpp index 3bd1fac99..7b511307e 100644 --- a/lib/base/application.cpp +++ b/lib/base/application.cpp @@ -506,6 +506,11 @@ void Application::DisplayBugMessage(std::ostream& os) << "***" << "\n"; } +String Application::GetCrashReportFilename(void) +{ + return GetLocalStateDir() + "/log/icinga2/crash/report." + Convert::ToString(Utility::GetTime()); +} + #ifndef _WIN32 /** * Signal handler for SIGINT and SIGTERM. Prepares the application for cleanly @@ -539,11 +544,6 @@ void Application::SigUsr1Handler(int) RequestReopenLogs(); } -String Application::GetCrashReportFilename(void) -{ - return GetLocalStateDir() + "/log/icinga2/crash/report." + Convert::ToString(Utility::GetTime()); -} - /** * Signal handler for SIGABRT. Helps with debugging ASSERT()s. * diff --git a/lib/base/scriptframe.cpp b/lib/base/scriptframe.cpp index 58323e5dc..6632ac625 100644 --- a/lib/base/scriptframe.cpp +++ b/lib/base/scriptframe.cpp @@ -22,3 +22,38 @@ using namespace icinga; boost::thread_specific_ptr ScriptFrame::m_CurrentFrame; + +ScriptFrame::ScriptFrame(void) + : Locals(new Dictionary()), Self(ScriptGlobal::GetGlobals()) +{ + NextFrame = GetCurrentFrame(); + SetCurrentFrame(this); +} + +ScriptFrame::ScriptFrame(const Value& self) + : Locals(new Dictionary()), Self(self) +{ + NextFrame = GetCurrentFrame(); + SetCurrentFrame(this); +} + +ScriptFrame::~ScriptFrame(void) +{ + ASSERT(GetCurrentFrame() == this); + SetCurrentFrame(NextFrame); +} + +ScriptFrame *ScriptFrame::GetCurrentFrame(void) +{ + ScriptFrame **pframe = m_CurrentFrame.get(); + + if (pframe) + return *pframe; + else + return NULL; +} + +void ScriptFrame::SetCurrentFrame(ScriptFrame *frame) +{ + m_CurrentFrame.reset(new ScriptFrame *(frame)); +} \ No newline at end of file diff --git a/lib/base/scriptframe.hpp b/lib/base/scriptframe.hpp index 76bb53c24..120697a3b 100644 --- a/lib/base/scriptframe.hpp +++ b/lib/base/scriptframe.hpp @@ -34,43 +34,16 @@ struct I2_BASE_API ScriptFrame Value Self; ScriptFrame *NextFrame; - ScriptFrame(void) - : Locals(new Dictionary()), Self(ScriptGlobal::GetGlobals()) - { - NextFrame = GetCurrentFrame(); - SetCurrentFrame(this); - } + ScriptFrame(void); + ScriptFrame(const Value& self); + ~ScriptFrame(void); - ScriptFrame(const Value& self) - : Locals(new Dictionary()), Self(self) - { - NextFrame = GetCurrentFrame(); - SetCurrentFrame(this); - } - - ~ScriptFrame(void) - { - ASSERT(GetCurrentFrame() == this); - SetCurrentFrame(NextFrame); - } - - static inline ScriptFrame *GetCurrentFrame(void) - { - ScriptFrame **pframe = m_CurrentFrame.get(); - - if (pframe) - return *pframe; - else - return NULL; - } + static ScriptFrame *GetCurrentFrame(void); private: static boost::thread_specific_ptr m_CurrentFrame; - static inline void SetCurrentFrame(ScriptFrame *frame) - { - m_CurrentFrame.reset(new ScriptFrame *(frame)); - } + static void SetCurrentFrame(ScriptFrame *frame); }; }