Add Component::GetCanonicalNameVal to avoid extra StringVal allocations

This commit is contained in:
Tim Wojtulewicz 2022-05-10 13:31:06 -07:00
parent 22ab3bb0b3
commit a680c2faf0
5 changed files with 51 additions and 3 deletions

View file

@ -103,8 +103,7 @@ function Files::__stop%(file_id: string%): bool
## :zeek:see:`Files::analyzer_name`.
function Files::__analyzer_name%(tag: Files::Tag%) : string
%{
const auto& n = zeek::file_mgr->GetComponentName(zeek::IntrusivePtr{zeek::NewRef{}, tag->AsEnumVal()});
return zeek::make_intrusive<zeek::StringVal>(n);
return zeek::file_mgr->GetComponentNameVal(zeek::IntrusivePtr{zeek::NewRef{}, tag->AsEnumVal()});
%}
## :zeek:see:`Files::file_exists`.