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

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

Issue 1529553003: Merge to XFA: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: 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..292e2a7b539ff93109bfa84a6e3a674abdcdbe83 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,6 @@ CFX_PtrList::CNode* CFX_PtrList::NewNode(CFX_PtrList::CNode* pPrev,
m_pNodeFree = pNode;
}
}
- ASSERT(m_pNodeFree != NULL);
CFX_PtrList::CNode* pNode = m_pNodeFree;
m_pNodeFree = m_pNodeFree->pNext;
pNode->pPrev = pPrev;
@@ -122,9 +121,9 @@ FX_POSITION CFX_PtrList::Find(void* searchValue, FX_POSITION startAfter) const {
} else {
pNode = pNode->pNext;
}
- for (; pNode != NULL; pNode = pNode->pNext)
- if (pNode->data == searchValue) {
+ for (; pNode; pNode = pNode->pNext) {
+ if (pNode->data == searchValue)
return (FX_POSITION)pNode;
- }
+ }
return NULL;
}

Powered by Google App Engine
This is Rietveld 408576698