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/src/fxge/ge/fx_ge_path.cpp | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) (limited to 'core/src/fxge/ge/fx_ge_path.cpp') diff --git a/core/src/fxge/ge/fx_ge_path.cpp b/core/src/fxge/ge/fx_ge_path.cpp index b50c271c20..9acbcabfbf 100644 --- a/core/src/fxge/ge/fx_ge_path.cpp +++ b/core/src/fxge/ge/fx_ge_path.cpp @@ -117,17 +117,12 @@ CFX_PathData::CFX_PathData() { m_pPoints = NULL; } CFX_PathData::~CFX_PathData() { - if (m_pPoints) { - FX_Free(m_pPoints); - } + FX_Free(m_pPoints); } void CFX_PathData::SetPointCount(int nPoints) { m_PointCount = nPoints; if (m_AllocCount < nPoints) { - if (m_pPoints) { - FX_Free(m_pPoints); - m_pPoints = NULL; - } + FX_Free(m_pPoints); m_pPoints = FX_Alloc(FX_PATHPOINT, nPoints); m_AllocCount = nPoints; } @@ -138,9 +133,7 @@ void CFX_PathData::AllocPointCount(int nPoints) { if (m_PointCount) { FXSYS_memcpy(pNewBuf, m_pPoints, m_PointCount * sizeof(FX_PATHPOINT)); } - if (m_pPoints) { - FX_Free(m_pPoints); - } + FX_Free(m_pPoints); m_pPoints = pNewBuf; m_AllocCount = nPoints; } @@ -640,9 +633,7 @@ CFX_GraphStateData::CFX_GraphStateData(const CFX_GraphStateData& src) { void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) { m_LineCap = src.m_LineCap; m_DashCount = src.m_DashCount; - if (m_DashArray) { - FX_Free(m_DashArray); - } + FX_Free(m_DashArray); m_DashArray = NULL; m_DashPhase = src.m_DashPhase; m_LineJoin = src.m_LineJoin; @@ -654,14 +645,10 @@ void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) { } } CFX_GraphStateData::~CFX_GraphStateData() { - if (m_DashArray) { - FX_Free(m_DashArray); - } + FX_Free(m_DashArray); } void CFX_GraphStateData::SetDashCount(int count) { - if (m_DashArray) { - FX_Free(m_DashArray); - } + FX_Free(m_DashArray); m_DashArray = NULL; m_DashCount = count; if (count == 0) { -- cgit v1.2.3