mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 21:48:21 +00:00
Completely rework return values from storage operations
This commit is contained in:
parent
8ddda016ff
commit
9ed3e33f97
50 changed files with 859 additions and 586 deletions
|
@ -144,10 +144,7 @@ public:
|
|||
}
|
||||
|
||||
IntrusivePtr& operator=(std::nullptr_t) noexcept {
|
||||
if ( ptr_ ) {
|
||||
Unref(ptr_);
|
||||
ptr_ = nullptr;
|
||||
}
|
||||
reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -161,6 +158,23 @@ public:
|
|||
|
||||
explicit operator bool() const noexcept { return ptr_ != nullptr; }
|
||||
|
||||
void reset() noexcept {
|
||||
if ( ptr_ ) {
|
||||
Unref(ptr_);
|
||||
ptr_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void reset(T* ptr) {
|
||||
if ( ptr_ )
|
||||
Unref(ptr_);
|
||||
|
||||
if ( ptr )
|
||||
Ref(ptr);
|
||||
|
||||
ptr_ = ptr;
|
||||
}
|
||||
|
||||
private:
|
||||
pointer ptr_ = nullptr;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue