Deprecate internal_func(), replace with zeek::lookup_func()

This commit is contained in:
Jon Siwek 2020-05-08 19:12:53 -07:00
parent a83941d64d
commit 26f6fe01c8
5 changed files with 34 additions and 8 deletions

View file

@ -795,6 +795,19 @@ Func* internal_func(const char* name)
return nullptr;
}
IntrusivePtr<Func> zeek::lookup_func(const char* name)
{
const auto& v = zeek::lookup_val(name);
if ( ! v )
return nullptr;
if ( ! IsFunc(v->Type()->Tag()) )
reporter->InternalError("Expected variable '%s' to be a function", name);
return {NewRef{}, v->AsFunc()};
}
EventHandlerPtr internal_handler(const char* name)
{
// If there already is an entry in the registry, we have a