xmloff/inc/XMLTextColumnsContext.hxx         |    4 +---
 xmloff/inc/xmltabi.hxx                       |    4 +---
 xmloff/source/style/xmltabi.cxx              |   11 ++++-------
 xmloff/source/text/XMLTextColumnsContext.cxx |   15 ++++++---------
 4 files changed, 12 insertions(+), 22 deletions(-)

New commits:
commit 261ea82f11b10a8d1ab8175f66e72077a7b3350d
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Feb 28 14:26:14 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Feb 28 19:09:13 2023 +0000

    no need to allocate XMLTextColumnsArray_Impl separately
    
    an empty vector is only 2 words big
    
    Change-Id: I3e4a9d42b9ecb44c57ce11c400a17a4c8b053eca
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147972
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/xmloff/inc/XMLTextColumnsContext.hxx 
b/xmloff/inc/XMLTextColumnsContext.hxx
index 9ce2715ba749..438f01c3a8ca 100644
--- a/xmloff/inc/XMLTextColumnsContext.hxx
+++ b/xmloff/inc/XMLTextColumnsContext.hxx
@@ -29,11 +29,9 @@ class XMLTextColumnContext_Impl;
 class XMLTextColumnSepContext_Impl;
 class SvXMLTokenMap;
 
-typedef std::vector<rtl::Reference<XMLTextColumnContext_Impl>> 
XMLTextColumnsArray_Impl;
-
 class XMLTextColumnsContext final :public XMLElementPropertyContext
 {
-    std::unique_ptr<XMLTextColumnsArray_Impl> pColumns;
+    std::vector<rtl::Reference<XMLTextColumnContext_Impl>> maColumns;
     rtl::Reference<XMLTextColumnSepContext_Impl> mxColumnSep;
     sal_Int16                nCount;
     bool                 bAutomatic;
diff --git a/xmloff/source/text/XMLTextColumnsContext.cxx 
b/xmloff/source/text/XMLTextColumnsContext.cxx
index 244a0eccec83..09c6ac1eb9a4 100644
--- a/xmloff/source/text/XMLTextColumnsContext.cxx
+++ b/xmloff/source/text/XMLTextColumnsContext.cxx
@@ -238,10 +238,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > 
XMLTextColumnsContext:
             new XMLTextColumnContext_Impl( GetImport(), nElement, xAttrList )};
 
         // add new tabstop to array of tabstops
-        if( !pColumns )
-            pColumns = std::make_unique<XMLTextColumnsArray_Impl>();
-
-        pColumns->push_back( xColumn );
+        maColumns.push_back( xColumn );
 
         return xColumn;
     }
@@ -272,8 +269,8 @@ void XMLTextColumnsContext::endFastElement(sal_Int32 
nElement )
         // zero columns = no columns -> 1 column
         xColumns->setColumnCount( 1 );
     }
-    else if( !bAutomatic && pColumns &&
-             pColumns->size() == static_cast<sal_uInt16>(nCount) )
+    else if( !bAutomatic &&
+             maColumns.size() == static_cast<sal_uInt16>(nCount) )
     {
         // if we have column descriptions, one per column, and we don't use
         // automatic width, then set the column widths
@@ -285,7 +282,7 @@ void XMLTextColumnsContext::endFastElement(sal_Int32 
nElement )
         for( i = 0; i < nCount; i++ )
         {
             const TextColumn& rColumn =
-                (*pColumns)[static_cast<sal_uInt16>(i)]->getTextColumn();
+                maColumns[static_cast<sal_uInt16>(i)]->getTextColumn();
             if( rColumn.Width > 0 )
             {
                 nRelWidth += rColumn.Width;
@@ -301,7 +298,7 @@ void XMLTextColumnsContext::endFastElement(sal_Int32 
nElement )
             for( i=0; i < nCount; i++ )
             {
                 TextColumn& rColumn =
-                    (*pColumns)[static_cast<sal_uInt16>(i)]->getTextColumn();
+                    maColumns[static_cast<sal_uInt16>(i)]->getTextColumn();
                 if( rColumn.Width == 0 )
                 {
                     rColumn.Width = nColWidth;
@@ -315,7 +312,7 @@ void XMLTextColumnsContext::endFastElement(sal_Int32 
nElement )
         Sequence< TextColumn > aColumns( static_cast<sal_Int32>(nCount) );
         TextColumn *pTextColumns = aColumns.getArray();
         for( i=0; i < nCount; i++ )
-            *pTextColumns++ = 
(*pColumns)[static_cast<sal_uInt16>(i)]->getTextColumn();
+            *pTextColumns++ = 
maColumns[static_cast<sal_uInt16>(i)]->getTextColumn();
 
         xColumns->setColumns( aColumns );
     }
commit d01769af5f79988ae4263586b623df501b37ed26
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Feb 28 14:24:46 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Feb 28 19:09:01 2023 +0000

    no need to allocate tabstops vector separately
    
    an empty vector is only 2 words big
    
    Change-Id: Ib8309d0819c88fe6a4f7cd322c37dd52190bd060
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147971
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/xmloff/inc/xmltabi.hxx b/xmloff/inc/xmltabi.hxx
index 81cc60e3d76a..c2e66f1a050d 100644
--- a/xmloff/inc/xmltabi.hxx
+++ b/xmloff/inc/xmltabi.hxx
@@ -26,12 +26,10 @@
 class SvXMLImport;
 class SvxXMLTabStopContext_Impl;
 
-typedef std::vector<rtl::Reference<SvxXMLTabStopContext_Impl>> 
SvxXMLTabStopArray_Impl;
-
 class SvxXMLTabStopImportContext final : public XMLElementPropertyContext
 {
 private:
-    std::unique_ptr<SvxXMLTabStopArray_Impl> mpTabStops;
+    std::vector<rtl::Reference<SvxXMLTabStopContext_Impl>> maTabStops;
 
 public:
     SvxXMLTabStopImportContext(SvXMLImport& rImport, sal_Int32 nElement,
diff --git a/xmloff/source/style/xmltabi.cxx b/xmloff/source/style/xmltabi.cxx
index 601c3f5fd191..e6d33b114936 100644
--- a/xmloff/source/style/xmltabi.cxx
+++ b/xmloff/source/style/xmltabi.cxx
@@ -136,10 +136,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > 
SvxXMLTabStopImportCon
             new SvxXMLTabStopContext_Impl( GetImport(), nElement, xAttrList )};
 
         // add new tabstop to array of tabstops
-        if( !mpTabStops )
-            mpTabStops = std::make_unique<SvxXMLTabStopArray_Impl>();
-
-        mpTabStops->push_back( xTabStopContext );
+        maTabStops.push_back( xTabStopContext );
 
         return xTabStopContext;
     }
@@ -151,17 +148,17 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > 
SvxXMLTabStopImportCon
 
 void SvxXMLTabStopImportContext::endFastElement(sal_Int32 nElement)
 {
-    sal_uInt16 nCount = mpTabStops ? mpTabStops->size() : 0;
+    sal_uInt16 nCount = maTabStops.size();
     uno::Sequence< style::TabStop> aSeq( nCount );
 
-    if( mpTabStops )
+    if( nCount )
     {
         sal_uInt16 nNewCount = 0;
 
         style::TabStop* pTabStops = aSeq.getArray();
         for( sal_uInt16 i=0; i < nCount; i++ )
         {
-            SvxXMLTabStopContext_Impl *pTabStopContext = 
(*mpTabStops)[i].get();
+            SvxXMLTabStopContext_Impl *pTabStopContext = maTabStops[i].get();
             const style::TabStop& rTabStop = pTabStopContext->getTabStop();
             bool bDflt = style::TabAlign_DEFAULT == rTabStop.Alignment;
             if( !bDflt || 0==i )

Reply via email to