mirror of
https://github.com/Icinga/icinga2.git
synced 2026-05-28 04:12:13 -04:00
Merge 4db7dbda0e into f63bbec4ab
This commit is contained in:
commit
fdbc7f3690
2 changed files with 14 additions and 14 deletions
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
boost::thread_specific_ptr<std::stack<ScriptFrame *> > ScriptFrame::m_ScriptFrames;
|
||||
boost::thread_specific_ptr<std::vector<ScriptFrame*>> 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<ScriptFrame *> *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<ScriptFrame *> *frames = m_ScriptFrames.get();
|
||||
auto frames (m_ScriptFrames.get());
|
||||
|
||||
ASSERT(!frames->empty());
|
||||
return frames->top();
|
||||
return frames->back();
|
||||
}
|
||||
|
||||
ScriptFrame *ScriptFrame::PopFrame()
|
||||
{
|
||||
std::stack<ScriptFrame *> *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<ScriptFrame *> *frames = m_ScriptFrames.get();
|
||||
auto frames (m_ScriptFrames.get());
|
||||
|
||||
if (!frames) {
|
||||
frames = new std::stack<ScriptFrame *>();
|
||||
frames = new std::vector<ScriptFrame*>();
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include "base/namespace.hpp"
|
||||
#include "base/scriptpermission.hpp"
|
||||
#include <boost/thread/tss.hpp>
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
|
@ -55,7 +55,7 @@ private:
|
|||
*/
|
||||
Namespace::Ptr Globals;
|
||||
|
||||
static boost::thread_specific_ptr<std::stack<ScriptFrame *> > m_ScriptFrames;
|
||||
static boost::thread_specific_ptr<std::vector<ScriptFrame*>> m_ScriptFrames;
|
||||
|
||||
static void PushFrame(ScriptFrame *frame);
|
||||
static ScriptFrame *PopFrame();
|
||||
|
|
|
|||
Loading…
Reference in a new issue