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

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

Issue 1520063002: Get rid of most instance of 'foo == NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@bstr_isnull
Patch Set: self review 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 c4909843a3e637c2b7980a5945c20cfcf1f291d6..623bd9a27091e89fe97884c4a430f3bf7c84dbef 100644
--- a/core/src/fxcrt/fx_basic_list.cpp
+++ b/core/src/fxcrt/fx_basic_list.cpp
@@ -37,7 +37,7 @@ FX_POSITION CFX_PtrList::AddHead(void* newElement) {
return (FX_POSITION)pNewNode;
}
FX_POSITION CFX_PtrList::InsertAfter(FX_POSITION position, void* newElement) {
- if (position == NULL) {
+ if (!position) {
return AddTail(newElement);
}
CNode* pOldNode = (CNode*)position;
@@ -81,7 +81,7 @@ void CFX_PtrList::RemoveAll() {
}
CFX_PtrList::CNode* CFX_PtrList::NewNode(CFX_PtrList::CNode* pPrev,
CFX_PtrList::CNode* pNext) {
- if (m_pNodeFree == NULL) {
+ if (!m_pNodeFree) {
CFX_Plex* pNewBlock =
CFX_Plex::Create(m_pBlocks, m_nBlockSize, sizeof(CNode));
CNode* pNode = (CNode*)pNewBlock->data();
@@ -117,10 +117,10 @@ FX_POSITION CFX_PtrList::FindIndex(int nIndex) const {
}
FX_POSITION CFX_PtrList::Find(void* searchValue, FX_POSITION startAfter) const {
CNode* pNode = (CNode*)startAfter;
Tom Sepez 2015/12/14 18:27:00 nit: This calls for a ? operator here.
Lei Zhang 2015/12/15 01:58:36 Done.
- if (pNode == NULL) {
- pNode = m_pNodeHead;
- } else {
+ if (pNode) {
pNode = pNode->pNext;
+ } else {
+ pNode = m_pNodeHead;
}
for (; pNode; pNode = pNode->pNext) {
if (pNode->data == searchValue) {

Powered by Google App Engine
This is Rietveld 408576698