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

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

Issue 1297713003: Don't bother checking pointers before delete[] and FX_Free(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 4 months 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
« no previous file with comments | « core/src/fxcrt/fx_basic_buffer.cpp ('k') | core/src/fxcrt/xml_int.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcrt/fx_basic_maps.cpp
diff --git a/core/src/fxcrt/fx_basic_maps.cpp b/core/src/fxcrt/fx_basic_maps.cpp
index 14a681b832c28c032f6175d9165ecc841b929631..1558ae6f75bd3f085afe6fb9918570ebda7d0428 100644
--- a/core/src/fxcrt/fx_basic_maps.cpp
+++ b/core/src/fxcrt/fx_basic_maps.cpp
@@ -23,10 +23,8 @@ CFX_MapPtrToPtr::CFX_MapPtrToPtr(int nBlockSize)
ASSERT(m_nBlockSize > 0);
}
void CFX_MapPtrToPtr::RemoveAll() {
- if (m_pHashTable) {
- FX_Free(m_pHashTable);
- m_pHashTable = NULL;
- }
+ FX_Free(m_pHashTable);
+ m_pHashTable = NULL;
m_nCount = 0;
m_pFreeList = NULL;
m_pBlocks->FreeDataChain();
@@ -134,10 +132,8 @@ CFX_MapPtrToPtr::CAssoc* CFX_MapPtrToPtr::NewAssoc() {
void CFX_MapPtrToPtr::InitHashTable(FX_DWORD nHashSize, FX_BOOL bAllocNow) {
ASSERT(m_nCount == 0);
ASSERT(nHashSize > 0);
- if (m_pHashTable != NULL) {
- FX_Free(m_pHashTable);
- m_pHashTable = NULL;
- }
+ FX_Free(m_pHashTable);
+ m_pHashTable = NULL;
if (bAllocNow) {
m_pHashTable = FX_Alloc(CAssoc*, nHashSize);
}
@@ -321,10 +317,8 @@ void CFX_MapByteStringToPtr::InitHashTable(FX_DWORD nHashSize,
FX_BOOL bAllocNow) {
ASSERT(m_nCount == 0);
ASSERT(nHashSize > 0);
- if (m_pHashTable != NULL) {
- FX_Free(m_pHashTable);
- m_pHashTable = NULL;
- }
+ FX_Free(m_pHashTable);
+ m_pHashTable = NULL;
if (bAllocNow) {
m_pHashTable = FX_Alloc(CAssoc*, nHashSize);
}
« no previous file with comments | « core/src/fxcrt/fx_basic_buffer.cpp ('k') | core/src/fxcrt/xml_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698