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

Unified Diff: core/include/fxcrt/fx_basic.h

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 | « no previous file | core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/include/fxcrt/fx_basic.h
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h
index cd6d4e048dbe63f1ced4e59fb289c468469b1b56..8f0212a467a87edc03bbdfceecd706fd555eaece 100644
--- a/core/include/fxcrt/fx_basic.h
+++ b/core/include/fxcrt/fx_basic.h
@@ -565,9 +565,7 @@ class CFX_FixedBufGrow {
}
}
void SetDataSize(int data_size) {
- if (m_pData) {
- FX_Free(m_pData);
- }
+ FX_Free(m_pData);
m_pData = NULL;
if (data_size > FixedSize) {
m_pData = FX_Alloc(DataType, data_size);
@@ -575,11 +573,7 @@ class CFX_FixedBufGrow {
FXSYS_memset(m_Data, 0, sizeof(DataType) * FixedSize);
}
}
- ~CFX_FixedBufGrow() {
- if (m_pData) {
- FX_Free(m_pData);
- }
- }
+ ~CFX_FixedBufGrow() { FX_Free(m_pData); }
operator DataType*() { return m_pData ? m_pData : m_Data; }
private:
@@ -1078,9 +1072,7 @@ class CFX_SortListArray {
void Clear() {
for (int32_t i = m_DataLists.GetUpperBound(); i >= 0; i--) {
DataList list = m_DataLists.ElementAt(i);
- if (list.data) {
- FX_Free(list.data);
- }
+ FX_Free(list.data);
}
m_DataLists.RemoveAll();
m_CurList = 0;
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698