[Libreoffice-commits] .: basctl/source basic/source sc/source sw/source

Takeshi Abe tabe at kemper.freedesktop.org
Wed Jan 25 10:03:39 PST 2012


 basctl/source/dlged/managelang.cxx |    3 +--
 basctl/source/dlged/propbrw.cxx    |    3 +--
 basic/source/classes/sbxmod.cxx    |   11 ++++-------
 basic/source/sbx/sbxbase.cxx       |    3 +--
 sc/source/core/data/column.cxx     |    2 +-
 sc/source/core/data/documen3.cxx   |    3 +--
 sc/source/core/data/table4.cxx     |    3 +--
 sw/source/core/text/itrform2.cxx   |    3 +--
 sw/source/core/txtnode/atrfld.cxx  |    3 +--
 sw/source/ui/docvw/edtwin.cxx      |    8 ++------
 10 files changed, 14 insertions(+), 28 deletions(-)

New commits:
commit bb51e8e72be424f0fd92350006c536a97fd4b210
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Thu Jan 26 01:02:30 2012 +0900

    Deleting a null pointer is safe

diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx
index eb16d60..58fd948 100644
--- a/basctl/source/dlged/managelang.cxx
+++ b/basctl/source/dlged/managelang.cxx
@@ -197,8 +197,7 @@ void ManageLanguageDialog::ClearLanguageBox()
     for ( i = 0; i < nCount; ++i )
     {
         LanguageEntry* pEntry = (LanguageEntry*)( m_aLanguageLB.GetEntryData(i) );
-        if ( pEntry )
-            delete pEntry;
+        delete pEntry;
     }
     m_aLanguageLB.Clear();
 }
diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx
index 5ee9c28..4e1f90f 100644
--- a/basctl/source/dlged/propbrw.cxx
+++ b/basctl/source/dlged/propbrw.cxx
@@ -308,8 +308,7 @@ Sequence< Reference< XInterface > >
             // next element
             pCurrent = pGroupIterator && pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
         }
-        if (pGroupIterator)
-            delete pGroupIterator;
+        delete pGroupIterator;
     }
 
     sal_Int32 nCount = aInterfaces.size();
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index d61b63c..40ae0d7 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -541,13 +541,10 @@ SbModule::SbModule( const String& rName,  sal_Bool bVBACompat )
 SbModule::~SbModule()
 {
     OSL_TRACE("Module named %s is destructing", rtl::OUStringToOString( GetName(), RTL_TEXTENCODING_UTF8 ).getStr() );
-    if( pImage )
-        delete pImage;
-    if( pBreaks )
-        delete pBreaks;
-    if( pClassData )
-        delete pClassData;
-        mxWrapper = NULL;
+    delete pImage;
+    delete pBreaks;
+    delete pClassData;
+    mxWrapper = NULL;
 }
 
 uno::Reference< script::XInvocation >
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index 303f382..e2987d0 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -55,8 +55,7 @@ SbxAppData& GetSbxData_Impl()
 
 SbxAppData::~SbxAppData()
 {
-    if( pBasicFormater )
-        delete pBasicFormater;
+    delete pBasicFormater;
 }
 
 
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 6c1c849..50f0e95 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -93,7 +93,7 @@ ScColumn::ScColumn() :
 ScColumn::~ScColumn()
 {
     FreeAll();
-    if (pAttrArray) delete pAttrArray;
+    delete pAttrArray;
 }
 
 
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 66973de..991eb6b 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -273,8 +273,7 @@ void ScDocument::SetDBCollection( ScDBCollection* pNewDBCollection, bool bRemove
         }
     }
 
-    if (pDBCollection)
-        delete pDBCollection;
+    delete pDBCollection;
 
     pDBCollection = pNewDBCollection;
 }
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index bc99c5c..dac4111 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -564,8 +564,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
         {
             if ( bGetPattern )
             {
-                if ( pNewPattern )
-                    delete pNewPattern;
+                delete pNewPattern;
                 if (bVertical)      // rInner&:=nRow, rOuter&:=nCol
                     pSrcPattern = aCol[nCol].GetPattern(static_cast<SCROW>(nAtSrc));
                 else                // rInner&:=nCol, rOuter&:=nRow
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 54a7825..b46d5b8 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1629,8 +1629,7 @@ xub_StrLen SwTxtFormatter::FormatLine( const xub_StrLen nStartPos )
     GetInfo().GetParaPortion()->GetReformat()->LeftMove( GetInfo().GetIdx() );
 
     // delete master copy of rest portion
-    if ( pSaveFld )
-        delete pSaveFld;
+    delete pSaveFld;
 
     xub_StrLen nNewStart = nStartPos + pCurr->GetLen();
 
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 4789c5f..dc285ef 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -134,8 +134,7 @@ void SwFmtFld::RegisterToFieldType( SwFieldType& rType )
 // #111840#
 void SwFmtFld::SetFld(SwField * _pField)
 {
-    if (NULL != pField)
-        delete pField;
+    delete pField;
 
     pField = _pField;
     Broadcast( SwFmtFldHint( this, SWFMTFLD_CHANGED ) );
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 77ec221..df44378 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -4602,11 +4602,7 @@ SwEditWin::~SwEditWin()
     delete pApplyTempl;
     rView.SetDrawFuncPtr(NULL);
 
-    if(pUserMarker)
-    {
-        delete pUserMarker;
-    }
-
+    delete pUserMarker;
     delete pAnchorMarker;
 }
 
@@ -5468,7 +5464,7 @@ void QuickHelpData::Move( QuickHelpData& rCpy )
     bIsTip = rCpy.bIsTip;
     bIsAutoText = rCpy.bIsAutoText;
 
-    if( pCETID ) delete pCETID;
+    delete pCETID;
     pCETID = rCpy.pCETID;
     rCpy.pCETID = 0;
 


More information about the Libreoffice-commits mailing list