From cfac954abcab7caf47d3fa3d641c553cba998271 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 19 Jun 2015 14:51:10 -0700 Subject: Cleanup: Do not check pointers before deleting them. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1192743004. --- core/src/fxge/dib/fx_dib_main.cpp | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'core/src/fxge/dib/fx_dib_main.cpp') diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp index a148334f3c..82a14974f4 100644 --- a/core/src/fxge/dib/fx_dib_main.cpp +++ b/core/src/fxge/dib/fx_dib_main.cpp @@ -48,9 +48,7 @@ CFX_DIBSource::~CFX_DIBSource() if (m_pPalette) { FX_Free(m_pPalette); } - if (m_pAlphaMask) { - delete m_pAlphaMask; - } + delete m_pAlphaMask; } CFX_DIBitmap::CFX_DIBitmap() { @@ -139,9 +137,7 @@ void CFX_DIBitmap::TakeOver(CFX_DIBitmap* pSrcBitmap) if (m_pPalette) { FX_Free(m_pPalette); } - if (m_pAlphaMask) { - delete m_pAlphaMask; - } + delete m_pAlphaMask; m_pBuffer = pSrcBitmap->m_pBuffer; m_pPalette = pSrcBitmap->m_pPalette; m_pAlphaMask = pSrcBitmap->m_pAlphaMask; @@ -1470,9 +1466,7 @@ CFX_DIBExtractor::CFX_DIBExtractor(const CFX_DIBSource* pSrc) } CFX_DIBExtractor::~CFX_DIBExtractor() { - if (m_pBitmap) { - delete m_pBitmap; - } + delete m_pBitmap; } CFX_FilteredDIB::CFX_FilteredDIB() { @@ -1481,7 +1475,7 @@ CFX_FilteredDIB::CFX_FilteredDIB() } CFX_FilteredDIB::~CFX_FilteredDIB() { - if (m_pSrc && m_bAutoDropSrc) { + if (m_bAutoDropSrc) { delete m_pSrc; } if (m_pScanline) { @@ -1521,9 +1515,7 @@ CFX_ImageRenderer::CFX_ImageRenderer() } CFX_ImageRenderer::~CFX_ImageRenderer() { - if (m_pTransformer) { - delete m_pTransformer; - } + delete m_pTransformer; } extern FX_RECT _FXDIB_SwapClipBox(FX_RECT& clip, int width, int height, FX_BOOL bFlipX, FX_BOOL bFlipY); FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClipRgn, @@ -1637,9 +1629,7 @@ CFX_BitmapStorer::CFX_BitmapStorer() } CFX_BitmapStorer::~CFX_BitmapStorer() { - if (m_pBitmap) { - delete m_pBitmap; - } + delete m_pBitmap; } CFX_DIBitmap* CFX_BitmapStorer::Detach() { @@ -1649,9 +1639,7 @@ CFX_DIBitmap* CFX_BitmapStorer::Detach() } void CFX_BitmapStorer::Replace(CFX_DIBitmap* pBitmap) { - if (m_pBitmap) { - delete m_pBitmap; - } + delete m_pBitmap; m_pBitmap = pBitmap; } void CFX_BitmapStorer::ComposeScanline(int line, const uint8_t* scanline, const uint8_t* scan_extra_alpha) -- cgit v1.2.3