summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2015-06-13 22:15:31 +0200
committerNoel Grandin <noel@peralex.com>2015-06-15 14:46:41 +0200
commit4729774b244db7a175077ed0c70aa48be62bc60e (patch)
tree9f0f2e329d269835d4c20a8183a2772b734608f3 /svtools
parent9db80b1499e09cde000160434728f7b231c30db8 (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 'svtools')
-rw-r--r--svtools/source/contnr/fileview.cxx5
-rw-r--r--svtools/source/contnr/treelistbox.cxx5
-rw-r--r--svtools/source/control/calendar.cxx6
-rw-r--r--svtools/source/graphic/grfcache.cxx7
-rw-r--r--svtools/source/misc/transfer2.cxx3
5 files changed, 8 insertions, 18 deletions
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 3fe79c84a2ec..10fa19fac992 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -1520,8 +1520,7 @@ NameTranslator_Impl::NameTranslator_Impl( const INetURLObject& rActualFolder )
NameTranslator_Impl::~NameTranslator_Impl()
{
- if( mpActFolder )
- delete mpActFolder;
+ delete mpActFolder;
}
void NameTranslator_Impl::SetActualFolder( const INetURLObject& rActualFolder )
@@ -1798,7 +1797,7 @@ void SvtFileView_Impl::FilterFolderContent_Impl( const OUString &rFilter )
if( bDelete )
{
// none of the filters did match
- delete (*aContentLoop);
+ delete *aContentLoop;
if ( maContent.begin() == aContentLoop )
{
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index a1f21fa35010..e4d83193bf18 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -1013,8 +1013,7 @@ void SvTreeListBox::EditText( const OUString& rStr, const Rectangle& rRect,
void SvTreeListBox::EditText( const OUString& rStr, const Rectangle& rRect,
const Selection& rSel, bool bMulti )
{
- if( pEdCtrl )
- delete pEdCtrl;
+ delete pEdCtrl;
nImpFlags |= SvTreeListBoxFlags::IN_EDT;
nImpFlags &= ~SvTreeListBoxFlags::EDTEND_CALLED;
HideFocus();
@@ -1040,8 +1039,6 @@ IMPL_LINK_NOARG(SvTreeListBox, TextEditEndedHdl_Impl)
// that we don't call the selection handler in the GetFocus of the listbox
// with the old entry text.
pEdCtrl->Hide();
- // delete pEdCtrl;
- // pEdCtrl = 0;
nImpFlags &= (~SvTreeListBoxFlags::IN_EDT);
GrabFocus();
return 0;
diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx
index f68514b54e47..af32fe4da4ad 100644
--- a/svtools/source/control/calendar.cxx
+++ b/svtools/source/control/calendar.cxx
@@ -1406,8 +1406,7 @@ void Calendar::MouseButtonDown( const MouseEvent& rMEvt )
DoubleClick();
else
{
- if ( mpOldSelectTable )
- delete mpOldSelectTable;
+ delete mpOldSelectTable;
maOldCurDate = maCurDate;
mpOldSelectTable = new IntDateSet( *mpSelectTable );
@@ -1994,8 +1993,7 @@ Rectangle Calendar::GetDateRect( const Date& rDate ) const
void Calendar::StartSelection()
{
- if ( mpOldSelectTable )
- delete mpOldSelectTable;
+ delete mpOldSelectTable;
maOldCurDate = maCurDate;
mpOldSelectTable = new IntDateSet( *mpSelectTable );
diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx
index 21aa7d7f10a2..fb1c9fa57219 100644
--- a/svtools/source/graphic/grfcache.cxx
+++ b/svtools/source/graphic/grfcache.cxx
@@ -778,11 +778,8 @@ sal_uLong GraphicDisplayCacheEntry::GetNeededSize( OutputDevice* pOut, const Poi
GraphicDisplayCacheEntry::~GraphicDisplayCacheEntry()
{
- if( mpMtf )
- delete mpMtf;
-
- if( mpBmpEx )
- delete mpBmpEx;
+ delete mpMtf;
+ delete mpBmpEx;
}
void GraphicDisplayCacheEntry::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz ) const
diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx
index d0bb2cd9a12c..c3e09908153d 100644
--- a/svtools/source/misc/transfer2.cxx
+++ b/svtools/source/misc/transfer2.cxx
@@ -201,8 +201,7 @@ void SAL_CALL DropTargetHelper::DropTargetListener::dragOver( const DropTargetDr
try
{
- if( mpLastDragOverEvent )
- delete mpLastDragOverEvent;
+ delete mpLastDragOverEvent;
mpLastDragOverEvent = new AcceptDropEvent( rDTDE.DropAction & ~DNDConstants::ACTION_DEFAULT, Point( rDTDE.LocationX, rDTDE.LocationY ), rDTDE );
mpLastDragOverEvent->mbDefault = ( ( rDTDE.DropAction & DNDConstants::ACTION_DEFAULT ) != 0 );