mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 04:28:20 +00:00
Pre-allocate and re-use Vals for bool, int, count, enum and empty string
This commit is contained in:
parent
dcbef9cbe3
commit
2982765128
136 changed files with 1859 additions and 1811 deletions
|
@ -386,7 +386,7 @@ Val* BroFunc::Call(val_list* args, Frame* parent) const
|
|||
loop_over_list(*args, i)
|
||||
Unref((*args)[i]);
|
||||
|
||||
return Flavor() == FUNC_FLAVOR_HOOK ? new Val(true, TYPE_BOOL) : 0;
|
||||
return Flavor() == FUNC_FLAVOR_HOOK ? val_mgr->GetTrue() : 0;
|
||||
}
|
||||
|
||||
Frame* f = new Frame(frame_size, this, args);
|
||||
|
@ -464,7 +464,7 @@ Val* BroFunc::Call(val_list* args, Frame* parent) const
|
|||
if ( flow == FLOW_BREAK )
|
||||
{
|
||||
// Short-circuit execution of remaining hook handler bodies.
|
||||
result = new Val(false, TYPE_BOOL);
|
||||
result = val_mgr->GetFalse();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ Val* BroFunc::Call(val_list* args, Frame* parent) const
|
|||
if ( Flavor() == FUNC_FLAVOR_HOOK )
|
||||
{
|
||||
if ( ! result )
|
||||
result = new Val(true, TYPE_BOOL);
|
||||
result = val_mgr->GetTrue();
|
||||
}
|
||||
|
||||
// Warn if the function returns something, but we returned from
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue