mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Factor static-local nil IntrusivePtrs to global locations
Minor optimization to remove any run-time impact.
This commit is contained in:
parent
a384bb8b81
commit
ea878208ba
8 changed files with 21 additions and 23 deletions
|
@ -14,7 +14,6 @@ typedef PList<Scope> scope_list;
|
|||
|
||||
static scope_list scopes;
|
||||
static Scope* top_scope;
|
||||
static IntrusivePtr<ID> nil_id;
|
||||
|
||||
Scope::Scope(IntrusivePtr<ID> id, attr_list* al)
|
||||
: scope_id(std::move(id))
|
||||
|
@ -64,7 +63,7 @@ const IntrusivePtr<ID>& Scope::Find(std::string_view name) const
|
|||
if ( entry != local.end() )
|
||||
return entry->second;
|
||||
|
||||
return nil_id;
|
||||
return ID::nil;
|
||||
}
|
||||
|
||||
IntrusivePtr<ID> Scope::Remove(std::string_view name)
|
||||
|
@ -172,7 +171,7 @@ const IntrusivePtr<ID>& lookup_ID(const char* name, const char* curr_module,
|
|||
return global_scope()->Find(globalname);
|
||||
}
|
||||
|
||||
return nil_id;
|
||||
return ID::nil;
|
||||
}
|
||||
|
||||
IntrusivePtr<ID> install_ID(const char* name, const char* module_name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue