Change EventHandler to store IntrusivePtr<Func>

Also deprecates the LocalHandler() and SetLocalHandler() methods,
replaced with GetFunc() and SetFunc().
This commit is contained in:
Jon Siwek 2020-05-21 01:06:05 -07:00
parent 3b6f60a810
commit fbc7725278
4 changed files with 20 additions and 27 deletions

View file

@ -14,17 +14,11 @@ EventHandler::EventHandler(std::string arg_name)
{
name = std::move(arg_name);
used = false;
local = nullptr;
error_handler = false;
enabled = true;
generate_always = false;
}
EventHandler::~EventHandler()
{
Unref(local);
}
EventHandler::operator bool() const
{
return enabled && ((local && local->HasBodies())
@ -52,15 +46,6 @@ const IntrusivePtr<FuncType>& EventHandler::GetType(bool check_export)
return type;
}
void EventHandler::SetLocalHandler(Func* f)
{
if ( local )
Unref(local);
Ref(f);
local = f;
}
void EventHandler::Call(const zeek::Args& vl, bool no_remote)
{
#ifdef PROFILE_BRO_FUNCTIONS