Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Unified Diff: core/src/fxcrt/fx_basic_list.cpp

Issue 1512763013: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/src/fxcrt/fx_basic_list.cpp
diff --git a/core/src/fxcrt/fx_basic_list.cpp b/core/src/fxcrt/fx_basic_list.cpp
index de5d9f32697c83177809a6866ad866975251b858..c4909843a3e637c2b7980a5945c20cfcf1f291d6 100644
--- a/core/src/fxcrt/fx_basic_list.cpp
+++ b/core/src/fxcrt/fx_basic_list.cpp
@@ -17,7 +17,7 @@ CFX_PtrList::CFX_PtrList(int nBlockSize)
FX_POSITION CFX_PtrList::AddTail(void* newElement) {
CNode* pNewNode = NewNode(m_pNodeTail, NULL);
pNewNode->data = newElement;
- if (m_pNodeTail != NULL) {
+ if (m_pNodeTail) {
m_pNodeTail->pNext = pNewNode;
} else {
m_pNodeHead = pNewNode;
@@ -28,7 +28,7 @@ FX_POSITION CFX_PtrList::AddTail(void* newElement) {
FX_POSITION CFX_PtrList::AddHead(void* newElement) {
CNode* pNewNode = NewNode(NULL, m_pNodeHead);
pNewNode->data = newElement;
- if (m_pNodeHead != NULL) {
+ if (m_pNodeHead) {
m_pNodeHead->pPrev = pNewNode;
} else {
m_pNodeTail = pNewNode;
@@ -43,7 +43,7 @@ FX_POSITION CFX_PtrList::InsertAfter(FX_POSITION position, void* newElement) {
CNode* pOldNode = (CNode*)position;
CNode* pNewNode = NewNode(pOldNode, pOldNode->pNext);
pNewNode->data = newElement;
- if (pOldNode->pNext != NULL) {
+ if (pOldNode->pNext) {
pOldNode->pNext->pPrev = pNewNode;
} else {
m_pNodeTail = pNewNode;
@@ -91,7 +91,7 @@ CFX_PtrList::CNode* CFX_PtrList::NewNode(CFX_PtrList::CNode* pPrev,
m_pNodeFree = pNode;
}
}
- ASSERT(m_pNodeFree != NULL);
+ ASSERT(m_pNodeFree);
Tom Sepez 2015/12/14 19:14:11 nit: segv two lines below.
Lei Zhang 2015/12/15 01:38:33 Done.
CFX_PtrList::CNode* pNode = m_pNodeFree;
m_pNodeFree = m_pNodeFree->pNext;
pNode->pPrev = pPrev;
@@ -122,9 +122,10 @@ FX_POSITION CFX_PtrList::Find(void* searchValue, FX_POSITION startAfter) const {
} else {
pNode = pNode->pNext;
}
- for (; pNode != NULL; pNode = pNode->pNext)
+ for (; pNode; pNode = pNode->pNext) {
if (pNode->data == searchValue) {
return (FX_POSITION)pNode;
Tom Sepez 2015/12/14 19:14:11 nit: as long as you're fixing braces, the if doesn
Lei Zhang 2015/12/15 01:38:33 Done.
}
+ }
return NULL;
}

Powered by Google App Engine
This is Rietveld 408576698