Skip to content

Commit 874afd9

Browse files
authored
Remove useless this pointer check (#710)
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.
1 parent f1a9905 commit 874afd9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

primedev/shared/keyvalues.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ bool KeyValues::IsEmpty(const char* pszKeyName)
511511
KeyValues* KeyValues::GetFirstTrueSubKey(void) const
512512
{
513513
assert_msg(this, "Member function called on NULL KeyValues");
514-
KeyValues* pRet = this ? m_pSub : nullptr;
514+
KeyValues* pRet = m_pSub;
515515
while (pRet && pRet->m_iDataType != TYPE_NONE)
516516
pRet = pRet->m_pPeer;
517517

@@ -525,7 +525,7 @@ KeyValues* KeyValues::GetFirstTrueSubKey(void) const
525525
KeyValues* KeyValues::GetNextTrueSubKey(void) const
526526
{
527527
assert_msg(this, "Member function called on NULL KeyValues");
528-
KeyValues* pRet = this ? m_pPeer : nullptr;
528+
KeyValues* pRet = m_pPeer;
529529
while (pRet && pRet->m_iDataType != TYPE_NONE)
530530
pRet = pRet->m_pPeer;
531531

@@ -539,7 +539,7 @@ KeyValues* KeyValues::GetNextTrueSubKey(void) const
539539
KeyValues* KeyValues::GetFirstValue(void) const
540540
{
541541
assert_msg(this, "Member function called on NULL KeyValues");
542-
KeyValues* pRet = this ? m_pSub : nullptr;
542+
KeyValues* pRet = m_pSub;
543543
while (pRet && pRet->m_iDataType == TYPE_NONE)
544544
pRet = pRet->m_pPeer;
545545

@@ -553,7 +553,7 @@ KeyValues* KeyValues::GetFirstValue(void) const
553553
KeyValues* KeyValues::GetNextValue(void) const
554554
{
555555
assert_msg(this, "Member function called on NULL KeyValues");
556-
KeyValues* pRet = this ? m_pPeer : nullptr;
556+
KeyValues* pRet = m_pPeer;
557557
while (pRet && pRet->m_iDataType == TYPE_NONE)
558558
pRet = pRet->m_pPeer;
559559

@@ -566,7 +566,7 @@ KeyValues* KeyValues::GetNextValue(void) const
566566
KeyValues* KeyValues::GetFirstSubKey() const
567567
{
568568
assert_msg(this, "Member function called on NULL KeyValues");
569-
return this ? m_pSub : nullptr;
569+
return m_pSub;
570570
}
571571

572572
//-----------------------------------------------------------------------------
@@ -575,7 +575,7 @@ KeyValues* KeyValues::GetFirstSubKey() const
575575
KeyValues* KeyValues::GetNextKey() const
576576
{
577577
assert_msg(this, "Member function called on NULL KeyValues");
578-
return this ? m_pPeer : nullptr;
578+
return m_pPeer;
579579
}
580580

581581
//-----------------------------------------------------------------------------

0 commit comments

Comments
 (0)