diff --git a/src/memory.h b/src/memory.h index 78ebed61..be6dcd11 100644 --- a/src/memory.h +++ b/src/memory.h @@ -41,20 +41,16 @@ namespace pkpy{ } shared_ptr& operator=(const shared_ptr& other) { - if (this != &other) { - _dec_counter(); - counter = other.counter; - _inc_counter(); - } + _dec_counter(); + counter = other.counter; + _inc_counter(); return *this; } shared_ptr& operator=(shared_ptr&& other) noexcept { - if (this != &other) { - _dec_counter(); - counter = other.counter; - other.counter = nullptr; - } + _dec_counter(); + counter = other.counter; + other.counter = nullptr; return *this; } diff --git a/src/safestl.h b/src/safestl.h index ce34f5df..1b75ee27 100644 --- a/src/safestl.h +++ b/src/safestl.h @@ -99,13 +99,11 @@ namespace pkpy { const PyVar& operator[](uint8_t i) const { return _args[i]; } ArgList& operator=(ArgList&& other) noexcept { - if(this != &other){ - __tryRelease(); - this->_args = other._args; - this->_size = other._size; - other._args = nullptr; - other._size = 0; - } + __tryRelease(); + this->_args = other._args; + this->_size = other._size; + other._args = nullptr; + other._size = 0; return *this; }