[Libreoffice-commits] core.git: xmloff/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 11 08:28:32 UTC 2020


 xmloff/source/style/xmlexppr.cxx |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 3a22f5a589e822e7ca8bbb00e38a3aff93ed7ba5
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Sep 11 09:26:41 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 11 10:27:57 2020 +0200

    optimisation: used std::vector for list of integers
    
    Change-Id: I98b211d632f0282faeaa30e971841faae89bfeff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102440
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index ec108f67beb5..92ba262a1921 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -151,16 +151,16 @@ void XMLPropertyStates_Impl::FillPropertyStateVector(
 
 class FilterPropertyInfo_Impl
 {
-    const OUString     sApiName;
-    std::list<sal_uInt32>   aIndexes;
+    OUString                msApiName;
+    std::vector<sal_uInt32> maIndexes;
 
 public:
 
     FilterPropertyInfo_Impl( const OUString& rApiName,
                              const sal_uInt32 nIndex);
 
-    const OUString& GetApiName() const { return sApiName; }
-    std::list<sal_uInt32>& GetIndexes() { return aIndexes; }
+    const OUString& GetApiName() const { return msApiName; }
+    std::vector<sal_uInt32>& GetIndexes() { return maIndexes; }
 
     // for sort
     bool operator< ( const FilterPropertyInfo_Impl& rArg ) const
@@ -172,9 +172,9 @@ public:
 FilterPropertyInfo_Impl::FilterPropertyInfo_Impl(
         const OUString& rApiName,
         const sal_uInt32 nIndex ) :
-    sApiName( rApiName )
+    msApiName( rApiName )
 {
-    aIndexes.push_back(nIndex);
+    maIndexes.push_back(nIndex);
 }
 
 typedef std::list<FilterPropertyInfo_Impl> FilterPropertyInfoList_Impl;
@@ -242,7 +242,12 @@ const uno::Sequence<OUString>& FilterPropertiesInfo_Impl::GetApiNames()
                 if ( aOld->GetApiName() == aCurrent->GetApiName() )
                 {
                     // if equal: merge index lists
-                    aOld->GetIndexes().merge( aCurrent->GetIndexes() );
+                    std::vector<sal_uInt32> aMerged;
+                    std::merge(aOld->GetIndexes().begin(), aOld->GetIndexes().end(),
+                               aCurrent->GetIndexes().begin(), aCurrent->GetIndexes().end(),
+                               std::back_inserter(aMerged));
+                    aOld->GetIndexes() = std::move(aMerged);
+                    aCurrent->GetIndexes().clear();
                     // erase element, and continue with next
                     aCurrent = aPropInfos.erase( aCurrent );
                     nCount--;


More information about the Libreoffice-commits mailing list