[Libreoffice-commits] .: sw/source

Ivan Timofeev ivantimofeev at kemper.freedesktop.org
Thu Nov 17 10:46:27 PST 2011


 sw/source/core/bastyp/calc.cxx          |    3 +--
 sw/source/core/crsr/crsrsh.cxx          |    7 ++-----
 sw/source/core/doc/docedt.cxx           |   12 ++++--------
 sw/source/core/doc/docfld.cxx           |    6 ++----
 sw/source/core/doc/docfmt.cxx           |    2 +-
 sw/source/core/doc/docnew.cxx           |   11 +++--------
 sw/source/core/doc/docredln.cxx         |    2 +-
 sw/source/core/docnode/ndtbl.cxx        |    2 +-
 sw/source/core/docnode/node.cxx         |    3 +--
 sw/source/core/frmedt/fefly1.cxx        |    3 +--
 sw/source/core/layout/atrfrm.cxx        |   13 +++++--------
 sw/source/core/layout/calcmove.cxx      |    6 ++----
 sw/source/core/layout/fly.cxx           |    3 +--
 sw/source/core/layout/ssfrm.cxx         |    3 +--
 sw/source/core/text/itradj.cxx          |    3 +--
 sw/source/core/text/itrform2.cxx        |    7 ++-----
 sw/source/core/text/porlay.cxx          |    6 ++----
 sw/source/core/text/txtdrop.cxx         |    3 +--
 sw/source/core/txtnode/fmtatr2.cxx      |    2 +-
 sw/source/core/txtnode/ndtxt.cxx        |    3 +--
 sw/source/core/unocore/unoframe.cxx     |    3 +--
 sw/source/core/unocore/unosett.cxx      |    2 +-
 sw/source/core/unocore/unotbl.cxx       |    3 +--
 sw/source/filter/ascii/parasc.cxx       |    3 +--
 sw/source/filter/html/htmlplug.cxx      |    6 ++----
 sw/source/filter/ww1/fltshell.cxx       |    6 ++----
 sw/source/filter/ww8/ww8par.cxx         |    6 ++----
 sw/source/filter/ww8/ww8par2.cxx        |    5 ++---
 sw/source/ui/app/applab.cxx             |    4 +---
 sw/source/ui/dbui/dbinsdlg.cxx          |    3 +--
 sw/source/ui/dialog/uiregionsw.cxx      |    6 ++----
 sw/source/ui/dochdl/swdtflvr.cxx        |    3 +--
 sw/source/ui/docvw/edtwin.cxx           |   19 +++++++------------
 sw/source/ui/envelp/labprt.cxx          |    3 +--
 sw/source/ui/ribbar/inputwin.cxx        |    3 +--
 sw/source/ui/table/tautofmt.cxx         |    2 +-
 sw/source/ui/uiview/formatclipboard.cxx |   23 +++++++++--------------
 sw/source/ui/uiview/pview.cxx           |    3 +--
 sw/source/ui/uiview/viewdraw.cxx        |    3 +--
 sw/source/ui/uno/SwXFilterOptions.cxx   |    3 +--
 sw/source/ui/utlui/glbltree.cxx         |    3 +--
 sw/source/ui/utlui/initui.cxx           |    3 +--
 sw/source/ui/utlui/numfmtlb.cxx         |    3 +--
 43 files changed, 76 insertions(+), 142 deletions(-)

New commits:
commit 3616dfb094089589b5c9082fc96702ad1155045f
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Thu Nov 17 22:13:42 2011 +0400

    redundant if not-null checks on delete

diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index ecee9a2..78ee52c 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -1626,8 +1626,7 @@ SwHash::SwHash( const String& rStr ) :
 
 SwHash::~SwHash()
 {
-    if( pNext )
-        delete pNext;
+    delete pNext;
 }
 
 void DeleteHashTable( SwHash **ppHashTable, sal_uInt16 nCount )
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index f402e02..7f859ed 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -120,11 +120,8 @@ void CheckRange( SwCursor* pCurCrsr )
          * Bereich gehoert !
          */
         pTmp = (SwPaM*)pTmp->GetNext();
-        if( pTmpDel )
-        {
-            delete pTmpDel;         // hebe alten Bereich auf
-            pTmpDel = 0;
-        }
+        delete pTmpDel;         // hebe alten Bereich auf
+        pTmpDel = 0;
     }
 }
 
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 3f15e8c..b4c8e07 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -691,11 +691,8 @@ _SaveRedlEndPosForRestore::_SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx
 
 _SaveRedlEndPosForRestore::~_SaveRedlEndPosForRestore()
 {
-    if( pSavArr )
-    {
-        delete pSavArr;
-        delete pSavIdx;
-    }
+    delete pSavArr;
+    delete pSavIdx;
 }
 
 void _SaveRedlEndPosForRestore::_Restore()
@@ -1236,8 +1233,7 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
         GetIDocumentUndoRedo().AppendUndo(pUndo);
     }
 
-    if( pSaveInsPos )
-        delete pSaveInsPos;
+    delete pSaveInsPos;
 
     if( bUpdateFtn )
     {
@@ -2500,7 +2496,7 @@ SetRedlineMode( eOld );
 // in die Autokorrektur
 void SwDoc::SetAutoCorrExceptWord( SwAutoCorrExceptWord* pNew )
 {
-    if( pACEWord && pNew != pACEWord )
+    if( pNew != pACEWord )
         delete pACEWord;
     pACEWord = pNew;
 }
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 3a81493..e5cd57e 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -673,8 +673,7 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt )
         }
     }
 
-    if( pCalc )
-        delete pCalc;
+    delete pCalc;
 }
 
 void SwDoc::UpdatePageFlds( SfxPoolItem* pMsgHnt )
@@ -2210,8 +2209,7 @@ void SwDocUpdtFld::MakeFldList( SwDoc& rDoc, int bAll, int eGetMode )
 void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode )
 {
     // new version: walk all fields of the attribute pool
-    if( pFldSortLst )
-        delete pFldSortLst;
+    delete pFldSortLst;
     pFldSortLst = new _SetGetExpFlds( 64, 16 );
 
     /// consider and unhide sections
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 16a0780..22a9773 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1138,7 +1138,7 @@ void SwDoc::ResetAttrAtFormat( const sal_uInt16 nWhichId,
 
         SetModified();
     }
-    else if ( pUndo )
+    else
         delete pUndo;
 }
 
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index d441723..8163a4e 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -498,12 +498,8 @@ SwDoc::~SwDoc()
     delete pRedlineTbl;
     delete pUnoCrsrTbl;
     delete pAutoFmtRedlnComment;
-
-    if( pUpdtFlds )
-        delete pUpdtFlds;
-
-    if( pACEWord )
-        delete pACEWord;
+    delete pUpdtFlds;
+    delete pACEWord;
 
     // die BaseLinks freigeben.
     {
@@ -769,8 +765,7 @@ void SwDoc::ClearDoc()
 
     pRedlineTbl->DeleteAndDestroy( 0, pRedlineTbl->Count() );
 
-    if( pACEWord )
-        delete pACEWord;
+    delete pACEWord;
 
     // in den BookMarks sind Indizies auf den Content. Diese muessen vorm
     // loesche der Nodes geloescht werden.
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index c3fc328..967bfc1 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -2585,7 +2585,7 @@ void SwDoc::SetAutoFmtRedlineComment( const String* pTxt, sal_uInt16 nSeqNo )
         else
             *pAutoFmtRedlnComment = *pTxt;
     }
-    else if( pAutoFmtRedlnComment )
+    else
         delete pAutoFmtRedlnComment, pAutoFmtRedlnComment = 0;
 
     nAutoFmtRedlnCommentNo = nSeqNo;
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 4054919..cda90ba 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2294,7 +2294,7 @@ sal_uInt16 SwDoc::MergeTbl( SwPaM& rPam )
                 GetIDocumentUndoRedo().AppendUndo( pUndo );
             }
         }
-        else if( pUndo )
+        else
             delete pUndo;
 
         rPam.GetPoint()->nNode = *pMergeBox->GetSttNd();
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index ad3c4a3..8164bcf 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1001,8 +1001,7 @@ SwCntntNode::~SwCntntNode()
     if( GetDepends() )
         DelFrms();
 
-    if( pCondColl )
-        delete pCondColl;
+    delete pCondColl;
 
     if ( mpAttrSet.get() && mbSetModifyAtAttr )
         ((SwAttrSet*)mpAttrSet.get())->SetModifyAtAttr( 0 );
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 0ebb362..6662c47 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1263,8 +1263,7 @@ void SwFEShell::SetFrmFmt( SwFrmFmt *pNewFmt, sal_Bool bKeepOrient, Point* pDocP
             else
                 GetLayout()->SetAssertFlyPages();
         }
-        if( pSet )
-            delete pSet;
+        delete pSet;
 
         EndAllActionAndCall();
     }
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index c89ef90..1e2d9ee 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -1507,8 +1507,7 @@ SwFmtAnchor::SwFmtAnchor( const SwFmtAnchor &rCpy )
 
 void SwFmtAnchor::SetAnchor( const SwPosition *pPos )
 {
-    if ( pCntntAnchor )
-        delete pCntntAnchor;
+    delete pCntntAnchor;
     pCntntAnchor = pPos ? new SwPosition( *pPos ) : 0;
         //AM Absatz gebundene Flys sollten nie in den Absatz hineinzeigen.
     if (pCntntAnchor &&
@@ -1630,7 +1629,7 @@ bool SwFmtAnchor::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
                     break;
                 case  text::TextContentAnchorType_AT_PAGE:
                     eAnchor = FLY_AT_PAGE;
-                    if( GetPageNum() > 0 && pCntntAnchor )
+                    if( GetPageNum() > 0 )
                     {
                         // If the anchor type is page and a valid page number
                         // has been set, the content position isn't required
@@ -1659,7 +1658,7 @@ bool SwFmtAnchor::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
             if((rVal >>= nVal) && nVal > 0)
             {
                 SetPageNum( nVal );
-                if ((FLY_AT_PAGE == GetAnchorId()) && pCntntAnchor)
+                if (FLY_AT_PAGE == GetAnchorId())
                 {
                     // If the anchor type is page and a valid page number
                     // is set, the content paoition has to be deleted to not
@@ -1705,8 +1704,7 @@ SwFmtURL::SwFmtURL( const SwFmtURL &rURL) :
 
 SwFmtURL::~SwFmtURL()
 {
-    if ( pMap )
-        delete pMap;
+    delete pMap;
 }
 
 int SwFmtURL::operator==( const SfxPoolItem &rAttr ) const
@@ -1740,8 +1738,7 @@ void SwFmtURL::SetURL( const XubString &rURL, sal_Bool bServerMap )
 
 void SwFmtURL::SetMap( const ImageMap *pM )
 {
-    if ( pMap )
-        delete pMap;
+    delete pMap;
     pMap = pM ? new ImageMap( *pM ) : 0;
 }
 extern const SvEventDescription* lcl_GetSupportedMacroItems();
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index bb9047c..33e3823 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -932,8 +932,7 @@ void SwLayoutFrm::MakeAll()
             Format( pAttrs );
         }
     } //while ( !bValidPos || !bValidSize || !bValidPrtArea )
-    if ( pAccess )
-        delete pAccess;
+    delete pAccess;
 }
 
 /*************************************************************************
@@ -1769,8 +1768,7 @@ void SwCntntFrm::MakeAll()
                          static_cast<SwTxtFrm&>(*this) );
 
 
-    if ( pSaveFtn )
-        delete pSaveFtn;
+    delete pSaveFtn;
 
     UnlockJoin();
     if ( bMovedFwd || bMovedBwd )
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index a2fc5bf..45da740 100755
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -538,8 +538,7 @@ void SwFlyFrm::FinitDrawObj()
     }
     GetVirtDrawObj()->SetUserCall( 0 ); //Ruft sonst Delete des ContactObj
     delete GetVirtDrawObj();            //Meldet sich selbst beim Master ab.
-    if ( pMyContact )
-        delete pMyContact;      //zerstoert den Master selbst.
+    delete pMyContact;      //zerstoert den Master selbst.
 }
 
 /*************************************************************************
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index e578bfd..cfd77c9 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -402,8 +402,7 @@ SwFrm::~SwFrm()
                 }
             }
         }
-        if ( pDrawObjs )
-            delete pDrawObjs;
+        delete pDrawObjs;
     }
 
 #if OSL_DEBUG_LEVEL > 1
diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index a502460..19fb4d1 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -597,8 +597,7 @@ SwMarginPortion *SwTxtAdjuster::CalcRightMargin( SwLineLayout *pCurrent,
             aCurrRect.Left( nLeftMar + nPrtWidth );
             pFly = CalcFlyPortion( nRealWidth, aCurrRect );
         }
-        if( pFly )
-            delete pFly;
+        delete pFly;
     }
 
     SwMarginPortion *pRight = new SwMarginPortion( 0 );
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 53a092c..ee83603 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -86,11 +86,8 @@ namespace {
 
 inline void ClearFly( SwTxtFormatInfo &rInf )
 {
-    if( rInf.GetFly() )
-    {
-        delete rInf.GetFly();
-        rInf.SetFly(0);
-    }
+    delete rInf.GetFly();
+    rInf.SetFly(0);
 }
 
 /*************************************************************************
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index d360414..f9d6936 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -155,13 +155,11 @@ sal_Bool lcl_ConnectToPrev( xub_Unicode cCh, xub_Unicode cPrevCh )
 SwLineLayout::~SwLineLayout()
 {
     Truncate();
-    if( GetNext() )
-        delete GetNext();
+    delete pNext;
     if( pBlink )
         pBlink->Delete( this );
     delete pLLSpaceAdd;
-    if ( pKanaComp )
-        delete pKanaComp;
+    delete pKanaComp;
 }
 
 /*************************************************************************
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index 298a3e9..961931b 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -116,8 +116,7 @@ SwDropSave::~SwDropSave()
 
 SwDropPortionPart::~SwDropPortionPart()
 {
-    if ( pFollow )
-        delete pFollow;
+    delete pFollow;
     delete pFnt;
 }
 
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index 0abbdf6..999742a 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -290,7 +290,7 @@ void SwFmtINetFmt::SetMacroTbl( const SvxMacroTableDtor* pNewTbl )
         else
             pMacroTbl = new SvxMacroTableDtor( *pNewTbl );
     }
-    else if( pMacroTbl )
+    else
         delete pMacroTbl, pMacroTbl = 0;
 }
 
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index a38c2d1..547891a 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2498,8 +2498,7 @@ SwTxtNode* SwTxtNode::_MakeNewTxtNode( const SwNodeIndex& rPos, sal_Bool bNext,
 
     SwTxtNode *pNode = new SwTxtNode( rPos, pColl, pNewAttrSet );
 
-    if( pNewAttrSet )
-        delete pNewAttrSet;
+    delete pNewAttrSet;
 
     const SwNumRule* pRule = GetNumRule();
     if( pRule && pRule == pNode->GetNumRule() && rNds.IsDocNodes() ) // #115901#
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 5ba469f..e919845 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -882,8 +882,7 @@ uno::Reference< beans::XPropertySetInfo >  SwXFrame::getPropertySetInfo(void) th
 
 void SwXFrame::SetSelection(SwPaM& rCopySource)
 {
-    if(m_pCopySource)
-        delete m_pCopySource;
+    delete m_pCopySource;
     m_pCopySource = new SwPaM( *rCopySource.Start() );
     m_pCopySource->SetMark();
     *m_pCopySource->GetMark() = *rCopySource.End();
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 289810e..4f2b456 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -1238,7 +1238,7 @@ SwXNumberingRules::~SwXNumberingRules()
     SolarMutexGuard aGuard;
     if(pDoc && sCreatedNumRuleName.Len())
         pDoc->DelNumRule( sCreatedNumRuleName );
-    if( pNumRule && bOwnNumRuleCreated )
+    if( bOwnNumRuleCreated )
         delete pNumRule;
 }
 
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index df6f302..834954e 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1547,8 +1547,7 @@ SwXTextTableCursor::~SwXTextTableCursor()
 {
     SolarMutexGuard aGuard;
     SwUnoCrsr* pUnoCrsr = GetCrsr();
-    if(pUnoCrsr)
-        delete pUnoCrsr;
+    delete pUnoCrsr;
 }
 
 OUString SwXTextTableCursor::getRangeName(void) throw( uno::RuntimeException )
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx
index fd4ab72..6f80a95 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -253,8 +253,7 @@ sal_uLong SwASCIIParser::CallParser()
         delete pItemSet, pItemSet = 0;
     }
 
-    if( pInsPam )
-        delete pInsPam;
+    delete pInsPam;
 
     ::EndProgress( pDoc->GetDocShell() );
     return nError;
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 8890c0b..accb529 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -505,8 +505,7 @@ void SwHTMLParser::NewObject()
     sal_Bool bPrcWidth = sal_False, bPrcHeight = sal_False,
              bDeclare = sal_False;
     // Eine neue Command-List anlegen
-    if( pAppletImpl )
-        delete pAppletImpl;
+    delete pAppletImpl;
     pAppletImpl = new SwApplet_Impl( pDoc->GetAttrPool(),
                                      RES_FRMATR_BEGIN, RES_FRMATR_END-1 );
 
@@ -675,8 +674,7 @@ void SwHTMLParser::InsertApplet()
     sal_Int16 eHoriOri = text::HoriOrientation::NONE;
 
     // Eine neue Command-List anlegen
-    if( pAppletImpl )
-        delete pAppletImpl;
+    delete pAppletImpl;
     pAppletImpl = new SwApplet_Impl( pDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 );
 
     const HTMLOptions& rHTMLOptions = GetOptions();
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index aa4c3fc..afb26ca 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -104,8 +104,7 @@ SwFltStackEntry::SwFltStackEntry(const SwPosition& rStartPos, SfxPoolItem* pHt)
 SwFltStackEntry::~SwFltStackEntry()
 {
     // Attribut kam zwar als Pointer, wird aber hier geloescht
-    if (pAttr)
-        delete pAttr;
+    delete pAttr;
 }
 
 void SwFltStackEntry::SetEndPos(const SwPosition& rEndPos)
@@ -1047,8 +1046,7 @@ SwFltShell::~SwFltShell()
 
     delete pPaM;
     for (i=0; i<sizeof(pColls)/sizeof(*pColls); i++)
-        if( pColls[i] )
-            delete pColls[i];
+        delete pColls[i];
     delete pOutDoc;
 }
 
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 50530c1..7d9337b 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -482,15 +482,13 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt,
                 {
                     case 0x038F: pImpRec->nXAlign = nUDData; break;
                     case 0x0390:
-                        if (pImpRec->pXRelTo)
-                            delete pImpRec->pXRelTo;
+                        delete pImpRec->pXRelTo;
                         pImpRec->pXRelTo = new sal_uInt32;
                         *(pImpRec->pXRelTo) = nUDData;
                         break;
                     case 0x0391: pImpRec->nYAlign = nUDData; break;
                     case 0x0392:
-                        if (pImpRec->pYRelTo)
-                            delete pImpRec->pYRelTo;
+                        delete pImpRec->pYRelTo;
                         pImpRec->pYRelTo = new sal_uInt32;
                         *(pImpRec->pYRelTo) = nUDData;
                         break;
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 5ec7a2e..1744284 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -914,13 +914,12 @@ void SwWW8ImplReader::SetNumOlst(SwNumRule* pNumR, WW8_OLST* pO, sal_uInt8 nSwLe
 // von Gliederungsabsaetzen zugreifbar ist.
 void SwWW8ImplReader::Read_OLST( sal_uInt16, const sal_uInt8* pData, short nLen )
 {
+    delete pNumOlst;
     if (nLen <= 0)
     {
-        delete pNumOlst, pNumOlst = 0;
+        pNumOlst = 0;
         return;
     }
-    if (pNumOlst)
-        delete pNumOlst;                    // nur sicherheitshalber
     pNumOlst = new WW8_OLST;
     if( nLen < sal::static_int_cast< sal_Int32 >(sizeof( WW8_OLST )) )         // auffuellen, falls zu kurz
         memset( pNumOlst, 0, sizeof( *pNumOlst ) );
diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx
index 69623dd..3bf837f 100644
--- a/sw/source/ui/app/applab.cxx
+++ b/sw/source/ui/app/applab.cxx
@@ -436,9 +436,7 @@ void SwModule::InsertLab(SfxRequest& rReq, sal_Bool bLabel)
         rReq.SetReturnValue(SfxVoidItem(bLabel ? FN_LABEL : FN_BUSINESS_CARD));
     }
     delete pDlg;
-
-    if( pNewDBMgr )
-        delete pNewDBMgr;
+    delete pNewDBMgr;
 }
 
 
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 4dc1204..f829db9 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -1831,8 +1831,7 @@ void SwInsertDBColAutoPilot::Load()
             else
                 aLbDbParaColl.SelectEntryPos( 0 );
 
-            if( pTAutoFmt )
-                delete pTAutoFmt, pTAutoFmt = 0;
+            delete pTAutoFmt, pTAutoFmt = 0;
             sTmp = pNewData->sTAutoFmtNm;
             if( sTmp.Len() )
             {
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index 8199981..5fb92c2 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -1115,8 +1115,7 @@ IMPL_LINK( SwEditRegionDlg, FileSearchHdl, PushButton *, EMPTYARG )
 
     m_pOldDefDlgParent = Application::GetDefDialogParent();
     Application::SetDefDialogParent( this );
-    if ( m_pDocInserter )
-        delete m_pDocInserter;
+    delete m_pDocInserter;
     m_pDocInserter = new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter") );
     m_pDocInserter->StartExecuteModal( LINK( this, SwEditRegionDlg, DlgClosedHdl ) );
     return 0;
@@ -1866,8 +1865,7 @@ IMPL_LINK( SwInsertSectionTabPage, FileSearchHdl, PushButton *, EMPTYARG )
 {
     m_pOldDefDlgParent = Application::GetDefDialogParent();
     Application::SetDefDialogParent( this );
-    if ( m_pDocInserter )
-        delete m_pDocInserter;
+    delete m_pDocInserter;
     m_pDocInserter = new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter") );
     m_pDocInserter->StartExecuteModal( LINK( this, SwInsertSectionTabPage, DlgClosedHdl ) );
     return 0;
diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx
index 9071837..4222949 100755
--- a/sw/source/ui/dochdl/swdtflvr.cxx
+++ b/sw/source/ui/dochdl/swdtflvr.cxx
@@ -1482,8 +1482,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData,
         rSh.GetView().StopShellTimer();
     }
 
-    if( pAction )
-        delete pAction;
+    delete pAction;
     if( bCallAutoCaption )
         rSh.GetView().AutoCaption( GRAPHIC_CAP );
 
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index f18433c..0bb9dac 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -342,11 +342,9 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier )
         PointerStyle eStyle = POINTER_FILL;
         if( rSh.IsOverReadOnlyPos( rLPt ))
         {
-            if( pUserMarker )
-            {
-                delete pUserMarker;
-                pUserMarker = 0L;
-            }
+            delete pUserMarker;
+            pUserMarker = 0L;
+
             eStyle = POINTER_NOTALLOWED;
         }
         else
@@ -373,7 +371,7 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier )
                     pUserMarker = new SdrDropMarkerOverlay( *rSh.GetDrawView(), aTmp );
                 }
             }
-            else if(pUserMarker)
+            else
             {
                 delete pUserMarker;
                 pUserMarker = 0L;
@@ -661,8 +659,7 @@ void SwEditWin::LeaveArea(const Point &rPos)
     JustifyAreaTimer();
     if( !aTimer.IsActive() )
         aTimer.Start();
-    if( pShadCrsr )
-        delete pShadCrsr, pShadCrsr = 0;
+    delete pShadCrsr, pShadCrsr = 0;
 }
 
 inline void SwEditWin::EnterArea()
@@ -1325,8 +1322,7 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
         // running on a document, no order is being taken
         return;
 
-    if( pShadCrsr )
-        delete pShadCrsr, pShadCrsr = 0;
+    delete pShadCrsr, pShadCrsr = 0;
     aKeyInputFlushTimer.Stop();
 
     sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() &&
@@ -2680,8 +2676,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
     }
 
     bWasShdwCrsr = 0 != pShadCrsr;
-    if( bWasShdwCrsr )
-        delete pShadCrsr, pShadCrsr = 0;
+    delete pShadCrsr, pShadCrsr = 0;
 
     const Point aDocPos( PixelToLogic( rMEvt.GetPosPixel() ) );
 
diff --git a/sw/source/ui/envelp/labprt.cxx b/sw/source/ui/envelp/labprt.cxx
index afabaf3..b4b7348 100644
--- a/sw/source/ui/envelp/labprt.cxx
+++ b/sw/source/ui/envelp/labprt.cxx
@@ -87,8 +87,7 @@ SwLabPrtPage::SwLabPrtPage(Window* pParent, const SfxItemSet& rSet) :
 
 SwLabPrtPage::~SwLabPrtPage()
 {
-    if (pPrinter)
-        delete pPrinter;
+    delete pPrinter;
 }
 
 IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton )
diff --git a/sw/source/ui/ribbar/inputwin.cxx b/sw/source/ui/ribbar/inputwin.cxx
index adda1db..f28dab0 100644
--- a/sw/source/ui/ribbar/inputwin.cxx
+++ b/sw/source/ui/ribbar/inputwin.cxx
@@ -143,8 +143,7 @@ SwInputWindow::~SwInputWindow()
         pView->GetHLineal().SetActive( sal_True );
         pView->GetVLineal().SetActive( sal_True );
     }
-    if ( pMgr )
-        delete pMgr;
+    delete pMgr;
     if(pWrtShell)
         pWrtShell->EndSelTblCells();
 
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index 7f197a5..6f702d7 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -303,7 +303,7 @@ void SwAutoFormatDlg::FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const
         else
             rToFill = new SwTableAutoFmt( *(*pTableTbl)[ nIndex ] );
     }
-    else if( rToFill )
+    else
         delete rToFill, rToFill = 0;
 }
 
diff --git a/sw/source/ui/uiview/formatclipboard.cxx b/sw/source/ui/uiview/formatclipboard.cxx
index a9bfa3f..d40ce9f 100644
--- a/sw/source/ui/uiview/formatclipboard.cxx
+++ b/sw/source/ui/uiview/formatclipboard.cxx
@@ -279,10 +279,8 @@ SwFormatClipboard::SwFormatClipboard()
 }
 SwFormatClipboard::~SwFormatClipboard()
 {
-    if(m_pItemSet)
-        delete m_pItemSet;
-    if(m_pTableItemSet)
-        delete m_pTableItemSet;
+    delete m_pItemSet;
+    delete m_pTableItemSet;
 }
 
 bool SwFormatClipboard::HasContent() const
@@ -569,16 +567,13 @@ void SwFormatClipboard::Paste( SwWrtShell& rWrtShell, SfxStyleSheetBasePool* pPo
 void SwFormatClipboard::Erase()
 {
     m_nSelectionType = 0;
-    if(m_pItemSet)
-    {
-        delete m_pItemSet;
-        m_pItemSet = 0;
-    }
-    if(m_pTableItemSet)
-    {
-        delete m_pTableItemSet;
-        m_pTableItemSet = 0;
-    }
+
+    delete m_pItemSet;
+    m_pItemSet = 0;
+
+    delete m_pTableItemSet;
+    m_pTableItemSet = 0;
+
     if( m_aCharStyle.Len() )
         m_aCharStyle.Erase();
     if( m_aParaStyle.Len() )
diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx
index 790cfb6..269e57c 100644
--- a/sw/source/ui/uiview/pview.cxx
+++ b/sw/source/ui/uiview/pview.cxx
@@ -210,8 +210,7 @@ SwPagePreViewWin::SwPagePreViewWin( Window *pParent, SwPagePreView& rPView )
 
 SwPagePreViewWin::~SwPagePreViewWin()
 {
-    if( mpViewShell )
-        delete mpViewShell;
+    delete mpViewShell;
 }
 
 void  SwPagePreViewWin::Paint( const Rectangle& rRect )
diff --git a/sw/source/ui/uiview/viewdraw.cxx b/sw/source/ui/uiview/viewdraw.cxx
index 8730908..55d3b5c 100644
--- a/sw/source/ui/uiview/viewdraw.cxx
+++ b/sw/source/ui/uiview/viewdraw.cxx
@@ -640,8 +640,7 @@ sal_Bool SwView::IsFormMode() const
 
 void SwView::SetDrawFuncPtr(SwDrawBase* pFuncPtr)
 {
-    if (pDrawActual)
-        delete pDrawActual;
+    delete pDrawActual;
     pDrawActual = pFuncPtr;
 }
 
diff --git a/sw/source/ui/uno/SwXFilterOptions.cxx b/sw/source/ui/uno/SwXFilterOptions.cxx
index 3af6e74..a2f54e7 100644
--- a/sw/source/ui/uno/SwXFilterOptions.cxx
+++ b/sw/source/ui/uno/SwXFilterOptions.cxx
@@ -144,8 +144,7 @@ sal_Int16 SwXFilterOptions::execute() throw (uno::RuntimeException)
         delete pAsciiDlg;
     }
 
-    if( pInStream )
-        delete pInStream;
+    delete pInStream;
 
     return nRet;
 }
diff --git a/sw/source/ui/utlui/glbltree.cxx b/sw/source/ui/utlui/glbltree.cxx
index 1855d9f..4fa1507 100644
--- a/sw/source/ui/utlui/glbltree.cxx
+++ b/sw/source/ui/utlui/glbltree.cxx
@@ -730,8 +730,7 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* pCont, const String* pF
     {
         pDefParentWin = Application::GetDefDialogParent();
         Application::SetDefDialogParent( this );
-        if ( pDocInserter )
-            delete pDocInserter;
+        delete pDocInserter;
         pDocInserter = new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter"), true );
         pDocInserter->StartExecuteModal( LINK( this, SwGlobalTree, DialogClosedHdl ) );
     }
diff --git a/sw/source/ui/utlui/initui.cxx b/sw/source/ui/utlui/initui.cxx
index ae6709d..1dba7a9 100644
--- a/sw/source/ui/utlui/initui.cxx
+++ b/sw/source/ui/utlui/initui.cxx
@@ -193,8 +193,7 @@ ShellResource::ShellResource()
 
 ShellResource::~ShellResource()
 {
-    if( pAutoFmtNameLst )
-        delete pAutoFmtNameLst, pAutoFmtNameLst = 0;
+    delete pAutoFmtNameLst;
 }
 
 String ShellResource::GetPageDescName( sal_uInt16 nNo, PageNameMode eMode )
diff --git a/sw/source/ui/utlui/numfmtlb.cxx b/sw/source/ui/utlui/numfmtlb.cxx
index bcaa7e0..e0c9abc 100644
--- a/sw/source/ui/utlui/numfmtlb.cxx
+++ b/sw/source/ui/utlui/numfmtlb.cxx
@@ -126,8 +126,7 @@ void NumFormatListBox::Init(short nFormatType, sal_Bool bUsrFmts)
 
 NumFormatListBox::~NumFormatListBox()
 {
-    if (pOwnFormatter)
-        delete pOwnFormatter;
+    delete pOwnFormatter;
 }
 
 SwView* NumFormatListBox::GetView()


More information about the Libreoffice-commits mailing list