mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Scope: convert Scope::Lookup() and others to template
Allows passing rvalue references which eliminates unnecessary std::string copies. This speeds up Zeek startup by 1-2%.
This commit is contained in:
parent
f8e9cc0fc5
commit
f1908b6212
2 changed files with 13 additions and 7 deletions
|
@ -177,11 +177,11 @@ ID* install_ID(const char* name, const char* module_name,
|
|||
|
||||
ID* id = new ID(full_name.data(), scope, is_export);
|
||||
if ( SCOPE_FUNCTION != scope )
|
||||
global_scope()->Insert(full_name, id);
|
||||
global_scope()->Insert(std::move(full_name), id);
|
||||
else
|
||||
{
|
||||
id->SetOffset(top_scope->Length());
|
||||
top_scope->Insert(full_name, id);
|
||||
top_scope->Insert(std::move(full_name), id);
|
||||
}
|
||||
|
||||
return id;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue