From cb62e7657b3a9a04142028a4e6614029a08e894b Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 14 Aug 2015 15:45:39 -0700 Subject: Don't bother checking pointers before delete[] and FX_Free(). R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1297713003 . --- core/include/fxcrt/fx_basic.h | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'core/include') diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index cd6d4e048d..8f0212a467 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; -- cgit v1.2.3