sc/source/filter/xml/xmlimprt.cxx |    8 ++++----
 sc/source/filter/xml/xmlimprt.hxx |   10 +++++-----
 2 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit fd24739199fc1d5d3a0487886735737461fb5328
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Fri Sep 3 19:00:37 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Sep 4 13:58:30 2021 +0200

    no need to allocate ScMyLabelRanges with unique_ptr
    
    Change-Id: I87564621a24737df74ad7475910250fde8dbe4fe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121621
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/source/filter/xml/xmlimprt.cxx 
b/sc/source/filter/xml/xmlimprt.cxx
index e0ff318fca37..bc480798e215 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -392,7 +392,7 @@ ScXMLImport::~ScXMLImport() noexcept
     pStylesImportHelper.reset();
 
     m_aMyNamedExpressions.clear();
-    pMyLabelRanges.reset();
+    maMyLabelRanges.clear();
     pValidations.reset();
     pDetectiveOpArray.reset();
 
@@ -1218,7 +1218,7 @@ sal_Int32 ScXMLImport::GetRangeType(const OUString& 
sRangeType)
 
 void ScXMLImport::SetLabelRanges()
 {
-    if (!pMyLabelRanges)
+    if (maMyLabelRanges.empty())
         return;
 
     uno::Reference <beans::XPropertySet> xPropertySet (GetModel(), 
uno::UNO_QUERY);
@@ -1237,7 +1237,7 @@ void ScXMLImport::SetLabelRanges()
     table::CellRangeAddress aLabelRange;
     table::CellRangeAddress aDataRange;
 
-    for (const auto& rxLabelRange : *pMyLabelRanges)
+    for (const auto& rxLabelRange : maMyLabelRanges)
     {
         sal_Int32 nOffset1(0);
         sal_Int32 nOffset2(0);
@@ -1254,7 +1254,7 @@ void ScXMLImport::SetLabelRanges()
         }
     }
 
-    pMyLabelRanges->clear();
+    maMyLabelRanges.clear();
 }
 
 namespace {
diff --git a/sc/source/filter/xml/xmlimprt.hxx 
b/sc/source/filter/xml/xmlimprt.hxx
index c585e4b0131d..efc5d3bacd4c 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -143,7 +143,7 @@ class ScXMLImport: public SvXMLImport
     ScMyNamedExpressions   m_aMyNamedExpressions;
     SheetNamedExpMap m_SheetNamedExpressions;
 
-    std::unique_ptr<ScMyLabelRanges>            pMyLabelRanges;
+    ScMyLabelRanges            maMyLabelRanges;
     std::unique_ptr<ScMyImportValidations>  pValidations;
     std::unique_ptr<ScMyImpDetectiveOpArray>    pDetectiveOpArray;
     std::unique_ptr<SolarMutexGuard>        pSolarMutexGuard;
@@ -230,10 +230,10 @@ public:
 
     void AddNamedExpression(SCTAB nTab, ScMyNamedExpression* pNamedExp);
 
-    void AddLabelRange(std::unique_ptr<const ScMyLabelRange> pMyLabelRange) {
-        if (!pMyLabelRanges)
-            pMyLabelRanges.reset(new ScMyLabelRanges);
-        pMyLabelRanges->push_back(std::move(pMyLabelRange)); }
+    void AddLabelRange(std::unique_ptr<const ScMyLabelRange> pMyLabelRange)
+    {
+        maMyLabelRanges.push_back(std::move(pMyLabelRange));
+    }
 
     void AddValidation(const ScMyImportValidation& rValidation) {
         if (!pValidations)

Reply via email to