IntrusivePtr: replace the "add_ref" parameter with tag structs

Using a runtime parameter is obscure and error-prone.  Avoiding
error-prone code and getting reference counting right is the whole
point of this class.
This commit is contained in:
Max Kellermann 2020-02-19 05:48:02 +01:00
parent 7c0863dccf
commit 31b3a56740
7 changed files with 41 additions and 15 deletions

View file

@ -207,7 +207,7 @@ static IntrusivePtr<EnumVal> lookup_enum_val(const char* module_name, const char
int index = et->Lookup(module_name, name);
assert(index >= 0);
IntrusivePtr<EnumVal> rval{et->GetVal(index), false};
IntrusivePtr<EnumVal> rval{AdoptRef{}, et->GetVal(index)};
return rval;
}