mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Replace make_intrusive<Frame>() with detail::MakeFrame()
This commit is contained in:
parent
9604ca5f0b
commit
47cd2047bd
3 changed files with 9 additions and 9 deletions
|
@ -77,7 +77,7 @@ DebuggerState::DebuggerState() {
|
||||||
BreakFromSignal(false);
|
BreakFromSignal(false);
|
||||||
|
|
||||||
// ### Don't choose this arbitrary size! Extend Frame.
|
// ### Don't choose this arbitrary size! Extend Frame.
|
||||||
dbg_locals = new Frame(1024, /* func = */ nullptr, /* fn_args = */ nullptr);
|
dbg_locals = detail::MakeFrame(1024, /* func = */ nullptr, /* fn_args = */ nullptr).release();
|
||||||
}
|
}
|
||||||
|
|
||||||
DebuggerState::~DebuggerState() { Unref(dbg_locals); }
|
DebuggerState::~DebuggerState() { Unref(dbg_locals); }
|
||||||
|
|
10
src/Func.cc
10
src/Func.cc
|
@ -331,7 +331,7 @@ ValPtr ScriptFunc::Invoke(zeek::Args* args, Frame* parent) const {
|
||||||
return Flavor() == FUNC_FLAVOR_HOOK ? val_mgr->True() : nullptr;
|
return Flavor() == FUNC_FLAVOR_HOOK ? val_mgr->True() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto f = make_intrusive<Frame>(frame_size, this, args);
|
auto f = detail::MakeFrame(frame_size, this, args);
|
||||||
|
|
||||||
// Hand down any trigger.
|
// Hand down any trigger.
|
||||||
if ( parent ) {
|
if ( parent ) {
|
||||||
|
@ -468,9 +468,9 @@ void ScriptFunc::CreateCaptures(Frame* f) {
|
||||||
if ( bodies[0].stmts->Tag() == STMT_ZAM )
|
if ( bodies[0].stmts->Tag() == STMT_ZAM )
|
||||||
captures_vec = std::make_unique<std::vector<ZVal>>();
|
captures_vec = std::make_unique<std::vector<ZVal>>();
|
||||||
else {
|
else {
|
||||||
delete captures_frame;
|
Unref(captures_frame);
|
||||||
delete captures_offset_mapping;
|
delete captures_offset_mapping;
|
||||||
captures_frame = new Frame(captures->size(), this, nullptr);
|
captures_frame = detail::MakeFrame(captures->size(), this, nullptr).release();
|
||||||
captures_offset_mapping = new OffsetMap;
|
captures_offset_mapping = new OffsetMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,7 +528,7 @@ void ScriptFunc::SetCaptures(Frame* f) {
|
||||||
const auto& captures = type->GetCaptures();
|
const auto& captures = type->GetCaptures();
|
||||||
ASSERT(captures);
|
ASSERT(captures);
|
||||||
|
|
||||||
delete captures_frame;
|
Unref(captures_frame);
|
||||||
delete captures_offset_mapping;
|
delete captures_offset_mapping;
|
||||||
captures_frame = f;
|
captures_frame = f;
|
||||||
captures_offset_mapping = new OffsetMap;
|
captures_offset_mapping = new OffsetMap;
|
||||||
|
@ -655,7 +655,7 @@ std::optional<BrokerData> ScriptFunc::SerializeCaptures() const {
|
||||||
auto& cv = *captures_vec;
|
auto& cv = *captures_vec;
|
||||||
auto& captures = *type->GetCaptures();
|
auto& captures = *type->GetCaptures();
|
||||||
int n = captures_vec->size();
|
int n = captures_vec->size();
|
||||||
auto temp_frame = make_intrusive<Frame>(n, this, nullptr);
|
auto temp_frame = detail::MakeFrame(n, this, nullptr);
|
||||||
|
|
||||||
for ( int i = 0; i < n; ++i ) {
|
for ( int i = 0; i < n; ++i ) {
|
||||||
auto c_i = cv[i].ToVal(captures[i].Id()->GetType());
|
auto c_i = cv[i].ToVal(captures[i].Id()->GetType());
|
||||||
|
|
|
@ -1066,11 +1066,11 @@ SetupResult setup(int argc, char** argv, Options* zopts) {
|
||||||
if ( stmts ) {
|
if ( stmts ) {
|
||||||
auto [body, scope] = get_global_stmts();
|
auto [body, scope] = get_global_stmts();
|
||||||
StmtFlowType flow;
|
StmtFlowType flow;
|
||||||
Frame f(scope->Length(), nullptr, nullptr);
|
auto f = detail::MakeFrame(scope->Length(), nullptr, nullptr);
|
||||||
g_frame_stack.push_back(&f);
|
g_frame_stack.push_back(f.get());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
body->Exec(&f, flow);
|
body->Exec(f.get(), flow);
|
||||||
} catch ( InterpreterException& ) {
|
} catch ( InterpreterException& ) {
|
||||||
reporter->FatalError("failed to execute script statements at top-level scope");
|
reporter->FatalError("failed to execute script statements at top-level scope");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue