low-level addition of enum values

This commit is contained in:
Vern Paxson 2021-03-18 10:36:52 -07:00
parent d53d2ac755
commit b242430bd1
2 changed files with 10 additions and 0 deletions

View file

@ -1367,6 +1367,14 @@ void EnumType::AddNameInternal(const string& module_name, const char* name,
names[fullname] = val;
}
void EnumType::AddNameInternal(const string& full_name, bro_int_t val)
{
names[full_name] = val;
if ( vals.find(val) == vals.end() )
vals[val] = make_intrusive<EnumVal>(IntrusivePtr{NewRef{}, this}, val);
}
bro_int_t EnumType::Lookup(const string& module_name, const char* name) const
{
NameMap::const_iterator pos =