mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00
IntrusivePtr: eliminate setPtr()
There are only two call sites, and those hard-code the `add_ref` parameter.
This commit is contained in:
parent
6f3e9d2c4c
commit
4dbc224e21
1 changed files with 5 additions and 10 deletions
|
@ -71,9 +71,9 @@ public:
|
|||
*
|
||||
* @param raw_ptr Pointer to the shared object.
|
||||
*/
|
||||
IntrusivePtr(AdoptRef, pointer raw_ptr) noexcept
|
||||
constexpr IntrusivePtr(AdoptRef, pointer raw_ptr) noexcept
|
||||
: ptr_(raw_ptr)
|
||||
{
|
||||
setPtr(raw_ptr, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,8 +85,10 @@ public:
|
|||
* @param raw_ptr Pointer to the shared object.
|
||||
*/
|
||||
IntrusivePtr(NewRef, pointer raw_ptr) noexcept
|
||||
: ptr_(raw_ptr)
|
||||
{
|
||||
setPtr(raw_ptr, true);
|
||||
if ( ptr_ )
|
||||
Ref(ptr_);
|
||||
}
|
||||
|
||||
IntrusivePtr(IntrusivePtr&& other) noexcept : ptr_(other.release())
|
||||
|
@ -158,13 +160,6 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
void setPtr(pointer raw_ptr, bool add_ref) noexcept
|
||||
{
|
||||
ptr_ = raw_ptr;
|
||||
if ( raw_ptr && add_ref )
|
||||
Ref(raw_ptr);
|
||||
}
|
||||
|
||||
pointer ptr_ = nullptr;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue