include/svl/itemset.hxx                  |    5 +----
 svl/source/items/itemset.cxx             |   24 +++---------------------
 sw/source/core/unocore/unocrsrhelper.cxx |    2 +-
 3 files changed, 5 insertions(+), 26 deletions(-)

New commits:
commit a6535669f9532b61ee5906d4b1339bc9af4b0882
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Aug 18 10:12:12 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Aug 18 12:01:00 2022 +0200

    use more pass-by-value in SfxItemSet
    
    which avoids some copying
    
    Change-Id: Id774c8947d0c2676425a1a192e0ac28c8f8402db
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138468
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx
index b6404b6cc984..52966ecc96d6 100644
--- a/include/svl/itemset.hxx
+++ b/include/svl/itemset.hxx
@@ -51,8 +51,6 @@ friend class SfxAllItemSet;
 private:
     SVL_DLLPRIVATE void       RecreateRanges_Impl(const WhichRangesContainer& 
pNewRanges);
 
-    SfxItemSet( SfxItemPool & pool, const WhichRangesContainer& wids, 
std::size_t items );
-
 public:
     SfxPoolItem const**         GetItems_Impl() const { return m_ppItems; }
 
@@ -77,8 +75,7 @@ public:
     SfxItemSet( const SfxItemSet& );
     SfxItemSet( SfxItemSet&& ) noexcept;
     SfxItemSet( SfxItemPool& );
-    SfxItemSet( SfxItemPool&, const WhichRangesContainer& ranges );
-    SfxItemSet( SfxItemPool&, WhichRangesContainer&& ranges );
+    SfxItemSet( SfxItemPool&, WhichRangesContainer ranges );
 
     SfxItemSet( SfxItemPool& rPool, sal_uInt16 nWhichStart, sal_uInt16 
nWhichEnd )
         : SfxItemSet(rPool, WhichRangesContainer(nWhichStart, nWhichEnd)) {}
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 93721dd756f2..4894e85a6a06 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -77,27 +77,9 @@ SfxItemSet::SfxItemSet( SfxItemPool& rPool, 
WhichRangesContainer&& ranges, SfxPo
     assert(svl::detail::validRanges2(m_pWhichRanges));
 }
 
-SfxItemSet::SfxItemSet(
-    SfxItemPool & pool,
-    const WhichRangesContainer& wids,
-    std::size_t items):
-    m_pPool(&pool), m_pParent(nullptr),
-    m_ppItems(new SfxPoolItem const *[items]{}),
-    m_pWhichRanges(wids),
-    m_nCount(0),
-    m_bItemsFixed(false)
-{
-    assert(wids.size() != 0);
-    assert(svl::detail::validRanges2(m_pWhichRanges));
-}
-
-SfxItemSet::SfxItemSet(SfxItemPool& pool, const WhichRangesContainer& wids)
-    : SfxItemSet(pool, wids, svl::detail::CountRanges(wids))
-{
-}
-
-SfxItemSet::SfxItemSet(SfxItemPool& pool, WhichRangesContainer&& wids)
-    : m_pPool(&pool), m_pParent(nullptr),
+SfxItemSet::SfxItemSet(SfxItemPool& pool, WhichRangesContainer wids)
+    : m_pPool(&pool),
+    m_pParent(nullptr),
     m_ppItems(new SfxPoolItem const *[svl::detail::CountRanges(wids)]{}),
     m_pWhichRanges(std::move(wids)),
     m_nCount(0),
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx 
b/sw/source/core/unocore/unocrsrhelper.cxx
index 9e24ebd8a4cf..dbd944334f5e 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1356,7 +1356,7 @@ void makeRedline( SwPaM const & rPaM,
             {
                 sal_uInt16 nStylePoolId = USHRT_MAX;
                 OUString sParaStyleName, sUIStyle;
-                SfxItemSet aItemSet(rDoc.GetAttrPool(), aWhichPairs);
+                SfxItemSet aItemSet(rDoc.GetAttrPool(), 
std::move(aWhichPairs));
 
                 for (size_t i = 0; i < aEntries.size(); ++i)
                 {

Reply via email to