mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
Change protected EnumVal ctor to use IntrusivePtr
This commit is contained in:
parent
440b0623ac
commit
902f93671c
2 changed files with 4 additions and 5 deletions
|
@ -1182,7 +1182,7 @@ void EnumType::CheckAndAddName(const string& module_name, const char* name,
|
||||||
AddNameInternal(module_name, name, val, is_export);
|
AddNameInternal(module_name, name, val, is_export);
|
||||||
|
|
||||||
if ( vals.find(val) == vals.end() )
|
if ( vals.find(val) == vals.end() )
|
||||||
vals[val] = make_intrusive<EnumVal>(this, val);
|
vals[val] = make_intrusive<EnumVal>(IntrusivePtr{NewRef{}, this}, val);
|
||||||
|
|
||||||
set<BroType*> types = BroType::GetAliases(GetName());
|
set<BroType*> types = BroType::GetAliases(GetName());
|
||||||
set<BroType*>::const_iterator it;
|
set<BroType*>::const_iterator it;
|
||||||
|
@ -1238,7 +1238,7 @@ IntrusivePtr<EnumVal> EnumType::GetVal(bro_int_t i)
|
||||||
|
|
||||||
if ( it == vals.end() )
|
if ( it == vals.end() )
|
||||||
{
|
{
|
||||||
rval = make_intrusive<EnumVal>(this, i);
|
rval = make_intrusive<EnumVal>(IntrusivePtr{NewRef{}, this}, i);
|
||||||
vals[i] = rval;
|
vals[i] = rval;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1011,9 +1011,8 @@ protected:
|
||||||
template<class T, class... Ts>
|
template<class T, class... Ts>
|
||||||
friend IntrusivePtr<T> make_intrusive(Ts&&... args);
|
friend IntrusivePtr<T> make_intrusive(Ts&&... args);
|
||||||
|
|
||||||
EnumVal(EnumType* t, int i) : Val(bro_int_t(i), {NewRef{}, t})
|
EnumVal(IntrusivePtr<EnumType> t, int i) : Val(bro_int_t(i), std::move(t))
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
void ValDescribe(ODesc* d) const override;
|
void ValDescribe(ODesc* d) const override;
|
||||||
IntrusivePtr<Val> DoClone(CloneState* state) override;
|
IntrusivePtr<Val> DoClone(CloneState* state) override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue