Skip to content

Commit

Permalink
refactor: remove unnecessary macro def ETL_SELF_DELETING_SHARED_OBJECT
Browse files Browse the repository at this point in the history
It is defined since ever (2005), so why we should consider #ifndef ?
  • Loading branch information
rodolforg committed Oct 11, 2023
1 parent 99f1221 commit 7bbdbe1
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions ETL/ETL/_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@

/* === T Y P E D E F S ===================================================== */

#define ETL_SELF_DELETING_SHARED_OBJECT

/* === C L A S S E S & S T R U C T S ======================================= */

namespace etl {
Expand Down Expand Up @@ -74,11 +72,7 @@ class shared_object
protected:
shared_object() noexcept : refcount(0) { }

#ifdef ETL_SELF_DELETING_SHARED_OBJECT
virtual ~shared_object() { }
#else
~shared_object() { }
#endif

public:
virtual void ref() const noexcept
Expand All @@ -90,10 +84,8 @@ class shared_object
virtual bool unref()const
{
bool ret = (bool)(--refcount);
#ifdef ETL_SELF_DELETING_SHARED_OBJECT
if (!ret)
delete this;
#endif
return ret;
}

Expand Down Expand Up @@ -183,13 +175,8 @@ class handle
{
pointer xobj(obj);
obj = nullptr;
#ifdef ETL_SELF_DELETING_SHARED_OBJECT
if(xobj)
xobj->unref();
#else
if(xobj && !xobj->unref())
delete xobj;
#endif
}

bool empty() const noexcept { return !obj; }
Expand Down

0 comments on commit 7bbdbe1

Please sign in to comment.