diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2015-06-13 22:15:31 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-06-15 14:46:41 +0200 |
commit | 4729774b244db7a175077ed0c70aa48be62bc60e (patch) | |
tree | 9f0f2e329d269835d4c20a8183a2772b734608f3 /vcl | |
parent | 9db80b1499e09cde000160434728f7b231c30db8 (diff) |
remove unnecessary check for null when calling delete
Idea originally from caolan.
Found using the following command:
find . -name *.cxx | xargs /opt/local/bin/grep -zlP '(?m)if\s*\(\s*\w+\s*\)\s*delete\s+\w+\;'
Change-Id: I3338f4e22193a6dfd6219c8c75835224a3392763
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/opengl/x11/salvd.cxx | 3 | ||||
-rw-r--r-- | vcl/source/fontsubset/gsub.cxx | 3 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 3 | ||||
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/salvd.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 6 | ||||
-rw-r--r-- | vcl/unx/gtk/window/gtksalframe.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/kde4/KDESalGraphics.cxx | 7 |
8 files changed, 10 insertions, 21 deletions
diff --git a/vcl/opengl/x11/salvd.cxx b/vcl/opengl/x11/salvd.cxx index 0b42c115ec2b..99abcddfdaab 100644 --- a/vcl/opengl/x11/salvd.cxx +++ b/vcl/opengl/x11/salvd.cxx @@ -61,8 +61,7 @@ X11OpenGLSalVirtualDevice::X11OpenGLSalVirtualDevice( SalGraphics* pGraphics, X11OpenGLSalVirtualDevice::~X11OpenGLSalVirtualDevice() { - if( mpGraphics ) - delete mpGraphics; + delete mpGraphics; } SalGraphics* X11OpenGLSalVirtualDevice::AcquireGraphics() diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx index a716ad719626..cd76e54303a6 100644 --- a/vcl/source/fontsubset/gsub.cxx +++ b/vcl/source/fontsubset/gsub.cxx @@ -319,8 +319,7 @@ bool ReadGSUB( struct _TrueTypeFont* pTTFile, void ReleaseGSUB(struct _TrueTypeFont* pTTFile) { GlyphSubstitution* pGlyphSubstitution = static_cast<GlyphSubstitution*>(pTTFile->pGSubstitution); - if( pGlyphSubstitution ) - delete pGlyphSubstitution; + delete pGlyphSubstitution; } int UseGSUB( struct _TrueTypeFont* pTTFile, int nGlyph ) diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 34637a251c1b..3d1231dbaf18 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -1646,8 +1646,7 @@ void ToolBox::dispose() mpFloatWin = NULL; // delete private data - if (mpData) - delete mpData; + delete mpData; mpData = NULL; // remove the lists when there are no more toolbox references to diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 4aa4269c6902..3e04d1b2ac44 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -77,8 +77,7 @@ ImplToolBoxPrivateData::ImplToolBoxPrivateData() : ImplToolBoxPrivateData::~ImplToolBoxPrivateData() { - if( m_pLayoutData ) - delete m_pLayoutData; + delete m_pLayoutData; delete mpMenu; } diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx index b0caab71ae5d..f4bce82a0509 100644 --- a/vcl/unx/generic/gdi/salvd.cxx +++ b/vcl/unx/generic/gdi/salvd.cxx @@ -162,8 +162,7 @@ X11SalVirtualDevice::X11SalVirtualDevice(SalGraphics* pGraphics, long &nDX, long X11SalVirtualDevice::~X11SalVirtualDevice() { - if( pGraphics_ ) - delete pGraphics_; + delete pGraphics_; pGraphics_ = NULL; if( GetDrawable() && !bExternPixmap_ ) diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 463d9fe00ced..203ca4c83620 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -390,10 +390,8 @@ public: void NWPixmapCacheData::SetPixmap( GdkX11Pixmap* pPixmap, GdkX11Pixmap* pMask ) { - if( m_pixmap ) - delete m_pixmap; - if( m_mask ) - delete m_mask; + delete m_pixmap; + delete m_mask; m_pixmap = pPixmap; m_mask = pMask; diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index e39e7682efaf..c67daeb7719c 100644 --- a/vcl/unx/gtk/window/gtksalframe.cxx +++ b/vcl/unx/gtk/window/gtksalframe.cxx @@ -881,8 +881,7 @@ GtkSalFrame::~GtkSalFrame() } #endif - if( m_pIMHandler ) - delete m_pIMHandler; + delete m_pIMHandler; if( m_pFixedContainer ) gtk_widget_destroy( GTK_WIDGET( m_pFixedContainer ) ); diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index ed6b130bd50d..1fa06fd2a112 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -80,8 +80,7 @@ KDESalGraphics::KDESalGraphics() : KDESalGraphics::~KDESalGraphics() { - if (m_image) - delete m_image; + delete m_image; } bool KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart part ) @@ -249,9 +248,7 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, //if no image, or resized, make a new image if (!m_image || m_image->size() != widgetRect.size()) { - if (m_image) - delete m_image; - + delete m_image; m_image = new QImage( widgetRect.width(), widgetRect.height(), QImage::Format_ARGB32 ); |