Skip to content

Commit

Permalink
Removed asserts from etl::unique_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
John Wellbelove committed Jul 20, 2024
1 parent 22dc6b2 commit e71596a
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions include/etl/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -1395,14 +1395,15 @@ namespace etl
//*********************************
void reset(pointer p_ = pointer()) ETL_NOEXCEPT
{
assert(p_ == ETL_NULLPTR || p_ != p);

pointer value = p;
p = p_;

if (value != ETL_NULLPTR)
if (p_ == ETL_NULLPTR || p_ != p)
{
deleter(value);
pointer value = p;
p = p_;

if (value != ETL_NULLPTR)
{
deleter(value);
}
}
}

Expand Down Expand Up @@ -1592,20 +1593,21 @@ namespace etl
{
pointer value = p;
p = ETL_NULLPTR;
return value;
return value;
}

//*********************************
void reset(pointer p_) ETL_NOEXCEPT
{
assert(p_ != p);

pointer value = p;
p = p_;

if (value != ETL_NULLPTR)
if (p_ != p)
{
deleter(value);
pointer value = p;
p = p_;

if (value != ETL_NULLPTR)
{
deleter(value);
}
}
}

Expand Down

0 comments on commit e71596a

Please sign in to comment.