diff --git a/lib/base/scriptframe.cpp b/lib/base/scriptframe.cpp index 244f3d59f..bd52331a7 100644 --- a/lib/base/scriptframe.cpp +++ b/lib/base/scriptframe.cpp @@ -10,7 +10,7 @@ using namespace icinga; -boost::thread_specific_ptr > ScriptFrame::m_ScriptFrames; +boost::thread_specific_ptr> ScriptFrame::m_ScriptFrames; static Namespace::Ptr l_SystemNS, l_StatsNS; @@ -69,10 +69,10 @@ ScriptFrame::ScriptFrame(bool allocLocals, Value self) void ScriptFrame::InitializeFrame() { - std::stack *frames = m_ScriptFrames.get(); + auto frames (m_ScriptFrames.get()); if (frames && !frames->empty()) { - ScriptFrame *frame = frames->top(); + ScriptFrame *frame = frames->back(); // See the documentation of `ScriptFrame::Globals` for why these two are inherited and Globals isn't. PermChecker = frame->PermChecker; @@ -142,37 +142,37 @@ void ScriptFrame::DecreaseStackDepth() ScriptFrame *ScriptFrame::GetCurrentFrame() { - std::stack *frames = m_ScriptFrames.get(); + auto frames (m_ScriptFrames.get()); ASSERT(!frames->empty()); - return frames->top(); + return frames->back(); } ScriptFrame *ScriptFrame::PopFrame() { - std::stack *frames = m_ScriptFrames.get(); + auto frames (m_ScriptFrames.get()); ASSERT(!frames->empty()); - ScriptFrame *frame = frames->top(); - frames->pop(); + ScriptFrame *frame = frames->back(); + frames->pop_back(); return frame; } void ScriptFrame::PushFrame(ScriptFrame *frame) { - std::stack *frames = m_ScriptFrames.get(); + auto frames (m_ScriptFrames.get()); if (!frames) { - frames = new std::stack(); + frames = new std::vector(); m_ScriptFrames.reset(frames); } if (!frames->empty()) { - ScriptFrame *parent = frames->top(); + ScriptFrame *parent = frames->back(); frame->Depth += parent->Depth; } - frames->push(frame); + frames->emplace_back(frame); } diff --git a/lib/base/scriptframe.hpp b/lib/base/scriptframe.hpp index 60aa57c0e..cb10907ea 100644 --- a/lib/base/scriptframe.hpp +++ b/lib/base/scriptframe.hpp @@ -9,7 +9,7 @@ #include "base/namespace.hpp" #include "base/scriptpermission.hpp" #include -#include +#include namespace icinga { @@ -55,7 +55,7 @@ private: */ Namespace::Ptr Globals; - static boost::thread_specific_ptr > m_ScriptFrames; + static boost::thread_specific_ptr> m_ScriptFrames; static void PushFrame(ScriptFrame *frame); static ScriptFrame *PopFrame();