sw/source/core/txtnode/ndhints.cxx |    2 +-
 sw/source/core/txtnode/thints.cxx  |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit f6d751971acf295e2567f30f56b529f273f2c05a
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Feb 8 09:37:44 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Feb 8 17:48:31 2022 +0100

    no need to take copies of the shared_ptr here
    
    and copying shared_ptr is fairly slow
    
    Change-Id: I0bf06056f867494319c087e113b3f77b5a5632c7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129656
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/core/txtnode/ndhints.cxx 
b/sw/source/core/txtnode/ndhints.cxx
index 194aafc95db1..167d5aee4f1d 100644
--- a/sw/source/core/txtnode/ndhints.cxx
+++ b/sw/source/core/txtnode/ndhints.cxx
@@ -203,7 +203,7 @@ bool SwpHints::Check(bool bPortionsMerged) const
             SwTextAttr const*const pHint(m_HintsByStart[i]);
             if (RES_TXTATR_AUTOFMT == pHint->Which())
             {
-                std::shared_ptr<SfxItemSet> const pSet(
+                std::shared_ptr<SfxItemSet> const & pSet(
                         pHint->GetAutoFormat().GetStyleHandle());
                 if (pSet->Count() == 1 && pSet->GetItem(RES_CHRATR_RSID, 
false))
                 {
diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index c7418514d31e..45e5e2f099f4 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -803,7 +803,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, 
SwTextAttr& rNewHint,
                     // the new character format:
                     OSL_ENSURE( RES_TXTATR_AUTOFMT == rpHint->Which(), 
"AUTOSTYLES - Misc trouble" );
                     SwTextAttr* pOther = rpHint;
-                    std::shared_ptr<SfxItemSet> pOldStyle = static_cast<const 
SwFormatAutoFormat&>(pOther->GetAttr()).GetStyleHandle();
+                    const std::shared_ptr<SfxItemSet> & pOldStyle = 
static_cast<const SwFormatAutoFormat&>(pOther->GetAttr()).GetStyleHandle();
 
                     // For each attribute in the automatic style check if it
                     // is also set the new character style:
@@ -868,7 +868,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, 
SwTextAttr& rNewHint,
             std::shared_ptr<SfxItemSet> pNewStyle = static_cast<const 
SwFormatAutoFormat&>(rNewHint.GetAttr()).GetStyleHandle();
             if ( pCurrentAutoStyle )
             {
-                std::shared_ptr<SfxItemSet> pCurrentStyle = static_cast<const 
SwFormatAutoFormat&>(pCurrentAutoStyle->GetAttr()).GetStyleHandle();
+                const std::shared_ptr<SfxItemSet> & pCurrentStyle = 
static_cast<const 
SwFormatAutoFormat&>(pCurrentAutoStyle->GetAttr()).GetStyleHandle();
 
                 // Merge attributes
                 SfxItemSet aNewSet( *pCurrentStyle );
@@ -1038,7 +1038,7 @@ SwTextAttr* MakeTextAttr(
     {
         // If the attribute is an auto-style which refers to a pool that is
         // different from rDoc's pool, we have to correct this:
-        const std::shared_ptr<SfxItemSet> pAutoStyle = static_cast<const 
SwFormatAutoFormat&>(rAttr).GetStyleHandle();
+        const std::shared_ptr<SfxItemSet> & pAutoStyle = static_cast<const 
SwFormatAutoFormat&>(rAttr).GetStyleHandle();
         SfxItemSet aNewSet =
                 pAutoStyle->SfxItemSet::CloneAsValue( true, 
&rDoc.GetAttrPool() );
         SwTextAttr* pNew = MakeTextAttr( rDoc, aNewSet, nStt, nEnd );
@@ -1881,7 +1881,7 @@ bool SwTextNode::SetAttr(
             const bool bAutoStyle = SfxItemState::SET == 
aTextSet.GetItemState( RES_TXTATR_AUTOFMT, false, &pItem );
             if ( bAutoStyle )
             {
-                std::shared_ptr<SfxItemSet> pAutoStyleSet = static_cast<const 
SwFormatAutoFormat*>(pItem)->GetStyleHandle();
+                const std::shared_ptr<SfxItemSet> & pAutoStyleSet = 
static_cast<const SwFormatAutoFormat*>(pItem)->GetStyleHandle();
                 const bool bRet = SetAttr( *pAutoStyleSet );
                 if( 1 == aTextSet.Count() )
                     return bRet;
@@ -2665,7 +2665,7 @@ bool SwpHints::MergePortions( SwTextNode& rNode )
         // check for RSID-only AUTOFMT
         if (RES_TXTATR_AUTOFMT == pHt->Which())
         {
-            std::shared_ptr<SfxItemSet> const pSet(
+            std::shared_ptr<SfxItemSet> const & pSet(
                     pHt->GetAutoFormat().GetStyleHandle());
             if ((pSet->Count() == 1) && pSet->GetItem(RES_CHRATR_RSID, false))
             {
@@ -2984,7 +2984,7 @@ bool SwpHints::TryInsertHint(
     // #i75430# Recalc hidden flags if necessary
     case RES_TXTATR_AUTOFMT:
     {
-        std::shared_ptr<SfxItemSet> const pSet( 
pHint->GetAutoFormat().GetStyleHandle() );
+        std::shared_ptr<SfxItemSet> const & pSet( 
pHint->GetAutoFormat().GetStyleHandle() );
         if (pHint->GetStart() == *pHint->GetEnd())
         {
             if (pSet->Count() == 1 && pSet->GetItem(RES_CHRATR_RSID, false))

Reply via email to