[Libreoffice-commits] .: 3 commits - cui/source svl/inc unusedcode.easy

Caolán McNamara caolan at kemper.freedesktop.org
Tue Jul 31 02:38:00 PDT 2012


 cui/source/inc/treeopt.hxx     |    4 ---
 cui/source/options/treeopt.cxx |   24 +++++++++++++-------
 svl/inc/svl/svarray.hxx        |   47 +----------------------------------------
 unusedcode.easy                |   13 -----------
 4 files changed, 18 insertions(+), 70 deletions(-)

New commits:
commit 7dcc3f5e900724c6bc46296ddb4aa83f16df17f3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 31 10:36:55 2012 +0100

    strip down the PTRARR macro to the bits the last two uses require
    
    Change-Id: I60323cd849e98b194af43e80aebc699ab662ed0e

diff --git a/svl/inc/svl/svarray.hxx b/svl/inc/svl/svarray.hxx
index 64d5403..23e702b 100644
--- a/svl/inc/svl/svarray.hxx
+++ b/svl/inc/svl/svarray.hxx
@@ -71,24 +71,6 @@ public:
 // SORTARR - Begin
 
 #define _SV_IMPL_SORTAR_ALG(nm, AE)\
-void nm::Insert( const nm * pI, sal_uInt16 nS, sal_uInt16 nE )\
-{\
-    if( USHRT_MAX == nE )\
-        nE = pI->Count();\
-    sal_uInt16 nP;\
-    const AE * pIArr = pI->GetData();\
-    for( ; nS < nE; ++nS )\
-    {\
-        if( ! Seek_Entry( *(pIArr+nS), &nP) )\
-                nm##_SAR::Insert( *(pIArr+nS), nP );\
-        if( ++nP >= Count() )\
-        {\
-            nm##_SAR::Insert( pI, nP, nS+1, nE );\
-            nS = nE;\
-        }\
-    }\
-}\
-\
 sal_Bool nm::Insert( const AE & aE )\
 {\
     sal_uInt16 nP;\
@@ -98,33 +80,12 @@ sal_Bool nm::Insert( const AE & aE )\
         nm##_SAR::Insert( aE, nP );\
     return !bExist;\
 }\
-sal_Bool nm::Insert( const AE & aE, sal_uInt16& rP )\
-{\
-    sal_Bool bExist;\
-    bExist = Seek_Entry( aE, &rP );\
-    if( ! bExist )\
-        nm##_SAR::Insert( aE, rP );\
-    return !bExist;\
-}\
-void nm::Insert( const AE* pE, sal_uInt16 nL)\
-{\
-    sal_uInt16 nP;\
-    for( sal_uInt16 n = 0; n < nL; ++n )\
-        if( ! Seek_Entry( *(pE+n), &nP ))\
-            nm##_SAR::Insert( *(pE+n), nP );\
-}\
+\
 void nm::Remove( sal_uInt16 nP, sal_uInt16 nL )\
 {\
     if( nL )\
         nm##_SAR::Remove( nP, nL);\
-}\
-\
-void nm::Remove( const AE &aE, sal_uInt16 nL )\
-{\
-    sal_uInt16 nP;\
-    if( nL && Seek_Entry( aE, &nP ) )   \
-        nm##_SAR::Remove( nP, nL);\
-}\
+}
 
 #define SV_DECL_PTRARR_SORT(nm, AE, IS)\
 class nm##_SAR: public SvPtrarr \
@@ -167,12 +128,8 @@ class nm : private nm##_SAR \
 public:\
     nm(sal_uInt16 nSize = IS)\
         : nm##_SAR(nSize) {}\
-    void Insert( const nm *pI, sal_uInt16 nS=0, sal_uInt16 nE=USHRT_MAX );\
     sal_Bool Insert( const AE& aE );\
-    sal_Bool Insert( const AE& aE, sal_uInt16& rP );\
-    void Insert( const AE *pE, sal_uInt16 nL );\
     void Remove( sal_uInt16 nP, sal_uInt16 nL = 1 );\
-    void Remove( const AE& aE, sal_uInt16 nL = 1 );\
     sal_uInt16 Count() const  {   return nm##_SAR::Count(); }\
     const AE* GetData() const { return (const AE*)pData; }\
     AE operator[](sal_uInt16 nP) const {\
diff --git a/unusedcode.easy b/unusedcode.easy
index 0dd7c11..14faca2 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -38,21 +38,9 @@ SvXMLStyleIndices_Impl::Remove(SvXMLStyleIndex_Impl*)
 SvtSlideSorterBarOptions::AddListenerLink(Link const&)
 SvtSlideSorterBarOptions::RemoveListenerLink(Link const&)
 SvxPositionSizeTabPage::GetRect()
-SwSortElements::Insert(SwSortElement* const&, unsigned short&)
-SwSortElements::Insert(SwSortElement* const*, unsigned short)
-SwSortElements::Insert(SwSortElements const*, unsigned short, unsigned short)
-SwSortElements::Remove(SwSortElement* const&, unsigned short)
 SwSortElements::Remove(unsigned short, unsigned short)
 SwXMLTableColumnsSortByWidth_Impl::GetPos(SwXMLTableColumn_Impl const*) const
 SwXMLTableColumnsSortByWidth_Impl::Remove(SwXMLTableColumn_Impl*)
-SwpHtEnd::Insert(SwTxtAttr const*&, unsigned short&)
-SwpHtEnd::Insert(SwTxtAttr const**, unsigned short)
-SwpHtEnd::Insert(SwpHtEnd const*, unsigned short, unsigned short)
-SwpHtEnd::Remove(SwTxtAttr const*&, unsigned short)
-SwpHtStart::Insert(SwTxtAttr const*&, unsigned short&)
-SwpHtStart::Insert(SwTxtAttr const**, unsigned short)
-SwpHtStart::Insert(SwpHtStart const*, unsigned short, unsigned short)
-SwpHtStart::Remove(SwTxtAttr const*&, unsigned short)
 TempFile::IsValid() const
 TextEngine::GetLeftMargin() const
 ThumbnailView::GetItemCount() const
commit 4e407dd808253f3298f9a5bd2eed3684b5e819ca
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 31 10:06:09 2012 +0100

    callcatcher: pModule is leaking
    
    Change-Id: I85aae76937c2416964d6e49cdd6ac39dca83ebbd

diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 2e4fad1..9100312 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -1926,13 +1926,18 @@ bool isNodeActive( OptionsNode* pNode, Module* pModule )
 void OfaTreeOptionsDialog::LoadExtensionOptions( const rtl::OUString& rExtensionId )
 {
     Module* pModule = NULL;
-    Reference< XMultiServiceFactory > xMSFac = comphelper::getProcessServiceFactory();
+
     // when called by Tools - Options then load nodes of active module
     if ( rExtensionId.isEmpty() )
+    {
+        Reference< XMultiServiceFactory > xMSFac = comphelper::getProcessServiceFactory();
         pModule = LoadModule( GetModuleIdentifier( xMSFac, Reference< XFrame >() ) );
+    }
 
     VectorOfNodes aNodeList = LoadNodes( pModule, rExtensionId );
     InsertNodes( aNodeList );
+
+    delete pModule;
 }
 
 rtl::OUString OfaTreeOptionsDialog::GetModuleIdentifier(
diff --git a/unusedcode.easy b/unusedcode.easy
index fad89f6..0dd7c11 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -163,7 +163,6 @@ sd::LeftDrawPaneShell::RegisterInterface(SfxModule*)
 sd::LeftImpressPaneShell::RegisterInterface(SfxModule*)
 sd::ToolPanelPaneShell::RegisterInterface(SfxModule*)
 sd::ViewShellBase::RegisterFactory(unsigned short)
-std::__cxx1998::vector<OrderedEntry*, std::allocator<OrderedEntry*> >::~vector()
 std::__cxx1998::vector<SfxFilter*, std::allocator<SfxFilter*> >::~vector()
 std::__cxx1998::vector<SfxItemDesruptor_Impl*, std::allocator<SfxItemDesruptor_Impl*> >::~vector()
 std::__cxx1998::vector<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::~vector()
commit d05136ca09494a129ccebf9e26feee64c3195134
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 31 10:01:18 2012 +0100

    use return optimization
    
    Change-Id: I9f56598e238f56b3648ecad6526634a2ee363e5b

diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index 38700e6..f10e524 100644
--- a/cui/source/inc/treeopt.hxx
+++ b/cui/source/inc/treeopt.hxx
@@ -192,9 +192,7 @@ private:
                                          const com::sun::star::uno::Reference<
                                             com::sun::star::frame::XFrame >& xFrame );
     Module*         LoadModule( const rtl::OUString& rModuleIdentifier );
-    void            LoadNodes( Module* pModule,
-                               const rtl::OUString& rExtensionId,
-                               VectorOfNodes& rOutNodeList );
+    VectorOfNodes   LoadNodes( Module* pModule, const rtl::OUString& rExtensionId );
     void            InsertNodes( const VectorOfNodes& rNodeList );
 
 protected:
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 9db1841..2e4fad1 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -1931,8 +1931,7 @@ void OfaTreeOptionsDialog::LoadExtensionOptions( const rtl::OUString& rExtension
     if ( rExtensionId.isEmpty() )
         pModule = LoadModule( GetModuleIdentifier( xMSFac, Reference< XFrame >() ) );
 
-    VectorOfNodes aNodeList;
-    LoadNodes( pModule, rExtensionId, aNodeList );
+    VectorOfNodes aNodeList = LoadNodes( pModule, rExtensionId );
     InsertNodes( aNodeList );
 }
 
@@ -2033,10 +2032,11 @@ Module* OfaTreeOptionsDialog::LoadModule(
     return pModule;
 }
 
-void OfaTreeOptionsDialog::LoadNodes(
-    Module* pModule, const rtl::OUString& rExtensionId,
-    VectorOfNodes& rOutNodeList )
+VectorOfNodes OfaTreeOptionsDialog::LoadNodes(
+    Module* pModule, const rtl::OUString& rExtensionId)
 {
+    VectorOfNodes aOutNodeList;
+
     Reference< XNameAccess > xSet(
         officecfg::Office::OptionsDialog::Nodes::get());
     VectorOfNodes aNodeList;
@@ -2148,7 +2148,7 @@ void OfaTreeOptionsDialog::LoadNodes(
             // do not insert nodes without leaves
             if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 )
             {
-                pModule ? aNodeList.push_back( pNode ) : rOutNodeList.push_back( pNode );
+                pModule ? aNodeList.push_back( pNode ) : aOutNodeList.push_back( pNode );
             }
         }
     }
@@ -2164,7 +2164,7 @@ void OfaTreeOptionsDialog::LoadNodes(
                 OptionsNode* pNode = aNodeList[j];
                 if ( pNode->m_sId == sNodeId )
                 {
-                    rOutNodeList.push_back( pNode );
+                    aOutNodeList.push_back( pNode );
                     aNodeList.erase( aNodeList.begin() + j );
                     break;
                 }
@@ -2172,8 +2172,9 @@ void OfaTreeOptionsDialog::LoadNodes(
         }
 
         for ( i = 0; i < aNodeList.size(); ++i )
-            rOutNodeList.push_back( aNodeList[i] );
+            aOutNodeList.push_back( aNodeList[i] );
     }
+    return aOutNodeList;
 }
 
 sal_uInt16 lcl_getGroupId( const rtl::OUString& rGroupName, const SvTreeListBox& rTreeLB )


More information about the Libreoffice-commits mailing list