From c6f2e35af02f80e071662dc42b64776723d5f501 Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Wed, 6 May 2020 16:45:01 -0700 Subject: [PATCH] Give make_intrusive() access to protected EnumVal ctor --- src/Type.cc | 4 ++-- src/Val.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Type.cc b/src/Type.cc index 85600e349d..fd05c82c3e 100644 --- a/src/Type.cc +++ b/src/Type.cc @@ -1209,7 +1209,7 @@ void EnumType::CheckAndAddName(const string& module_name, const char* name, AddNameInternal(module_name, name, val, is_export); if ( vals.find(val) == vals.end() ) - vals[val] = IntrusivePtr{AdoptRef{}, new EnumVal(this, val)}; + vals[val] = make_intrusive(this, val); set types = BroType::GetAliases(GetName()); set::const_iterator it; @@ -1265,7 +1265,7 @@ IntrusivePtr EnumType::GetVal(bro_int_t i) if ( it == vals.end() ) { - rval = IntrusivePtr{AdoptRef{}, new EnumVal(this, i)}; + rval = make_intrusive(this, i); vals[i] = rval; } else diff --git a/src/Val.h b/src/Val.h index 3aa128c5f6..95a687709c 100644 --- a/src/Val.h +++ b/src/Val.h @@ -998,6 +998,9 @@ protected: friend class Val; friend class EnumType; + template + friend IntrusivePtr make_intrusive(Ts&&... args); + EnumVal(EnumType* t, int i) : Val(bro_int_t(i), t) { }