summaryrefslogtreecommitdiff
path: root/core/src/fxcrt/fx_basic_list.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxcrt/fx_basic_list.cpp')
-rw-r--r--core/src/fxcrt/fx_basic_list.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/core/src/fxcrt/fx_basic_list.cpp b/core/src/fxcrt/fx_basic_list.cpp
index de5d9f3269..292e2a7b53 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;
}