diff options
author | Jan <sentrycraft123@gmail.com> | 2024-06-20 16:47:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-20 16:47:05 +0200 |
commit | 874afd95ff1bf88b602241486e39b3ecfaadd758 (patch) | |
tree | d081537d56a91b3e3d634209d1fda2b3a4299022 | |
parent | f1a990575eb87787c77eacb99be29171e4b3098d (diff) | |
download | NorthstarLauncher-874afd95ff1bf88b602241486e39b3ecfaadd758.tar.gz NorthstarLauncher-874afd95ff1bf88b602241486e39b3ecfaadd758.zip |
Remove useless `this` pointer check (#710)v1.25.2-rc1v1.25.2
The standard states that this must always be a valid pointer so these checks are optimized out anyway.
Sane compilers, such as clang, also complain about this and state that this is pointless.
-rw-r--r-- | primedev/shared/keyvalues.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/primedev/shared/keyvalues.cpp b/primedev/shared/keyvalues.cpp index 36f891eb..46ce4e04 100644 --- a/primedev/shared/keyvalues.cpp +++ b/primedev/shared/keyvalues.cpp @@ -511,7 +511,7 @@ bool KeyValues::IsEmpty(const char* pszKeyName) KeyValues* KeyValues::GetFirstTrueSubKey(void) const { assert_msg(this, "Member function called on NULL KeyValues"); - KeyValues* pRet = this ? m_pSub : nullptr; + KeyValues* pRet = m_pSub; while (pRet && pRet->m_iDataType != TYPE_NONE) pRet = pRet->m_pPeer; @@ -525,7 +525,7 @@ KeyValues* KeyValues::GetFirstTrueSubKey(void) const KeyValues* KeyValues::GetNextTrueSubKey(void) const { assert_msg(this, "Member function called on NULL KeyValues"); - KeyValues* pRet = this ? m_pPeer : nullptr; + KeyValues* pRet = m_pPeer; while (pRet && pRet->m_iDataType != TYPE_NONE) pRet = pRet->m_pPeer; @@ -539,7 +539,7 @@ KeyValues* KeyValues::GetNextTrueSubKey(void) const KeyValues* KeyValues::GetFirstValue(void) const { assert_msg(this, "Member function called on NULL KeyValues"); - KeyValues* pRet = this ? m_pSub : nullptr; + KeyValues* pRet = m_pSub; while (pRet && pRet->m_iDataType == TYPE_NONE) pRet = pRet->m_pPeer; @@ -553,7 +553,7 @@ KeyValues* KeyValues::GetFirstValue(void) const KeyValues* KeyValues::GetNextValue(void) const { assert_msg(this, "Member function called on NULL KeyValues"); - KeyValues* pRet = this ? m_pPeer : nullptr; + KeyValues* pRet = m_pPeer; while (pRet && pRet->m_iDataType == TYPE_NONE) pRet = pRet->m_pPeer; @@ -566,7 +566,7 @@ KeyValues* KeyValues::GetNextValue(void) const KeyValues* KeyValues::GetFirstSubKey() const { assert_msg(this, "Member function called on NULL KeyValues"); - return this ? m_pSub : nullptr; + return m_pSub; } //----------------------------------------------------------------------------- @@ -575,7 +575,7 @@ KeyValues* KeyValues::GetFirstSubKey() const KeyValues* KeyValues::GetNextKey() const { assert_msg(this, "Member function called on NULL KeyValues"); - return this ? m_pPeer : nullptr; + return m_pPeer; } //----------------------------------------------------------------------------- |