[Libreoffice-commits] core.git: sc/inc sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Feb 28 18:03:37 UTC 2019
sc/inc/table.hxx | 13 +++----------
sc/source/core/data/table1.cxx | 8 ++++++++
2 files changed, 11 insertions(+), 10 deletions(-)
New commits:
commit f9845d1a2dd84e7bbc9975b3a301b5a9bd38fb4a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Feb 28 14:45:17 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Feb 28 19:03:07 2019 +0100
simplify CreateColumnIfNotExists
if "if (aOldColSize==0)" check can never be hit since we pre-allocate
these columns to some size.
Also move the cold part of the function out-of-line, doesn't seem useful
to have all of it in a header
Change-Id: If8675ca17d70ee55dde8418ff75e2ddb3c931c58
Reviewed-on: https://gerrit.libreoffice.org/68506
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index ee217ba50c82..a4dd113a0cd9 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -276,18 +276,11 @@ public:
ScColumn& CreateColumnIfNotExists( const SCCOL nScCol )
{
if ( nScCol >= aCol.size() )
- {
- const SCCOL aOldColSize = aCol.size();
- bool bUseEmptyAttrArray = false;
- if ( aOldColSize == 0 )
- bUseEmptyAttrArray = true;
- aCol.resize( static_cast< size_t >( nScCol + 1 ) );
- for (SCCOL i = aOldColSize; i <= nScCol; i++)
- aCol[i].Init( i, nTab, pDocument, bUseEmptyAttrArray );
-
- }
+ CreateColumnIfNotExistsImpl(nScCol);
return aCol[nScCol];
}
+ // out-of-line the cold part of the function
+ void CreateColumnIfNotExistsImpl( const SCCOL nScCol );
sal_uLong GetCellCount() const;
sal_uLong GetWeightedCount() const;
sal_uLong GetWeightedCount(SCROW nStartRow, SCROW nEndRow) const;
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 7c5555c9f679..6fb453807604 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -2533,4 +2533,12 @@ ScColumnsRange ScTable::GetColumnsRange(SCCOL nColBegin, SCCOL nColEnd) const
ScColumnsRange::Iterator( aCol.begin() + nEffEnd));
}
+// out-of-line the cold part of the CreateColumnIfNotExists function
+void ScTable::CreateColumnIfNotExistsImpl( const SCCOL nScCol )
+{
+ const SCCOL aOldColSize = aCol.size();
+ aCol.resize( static_cast< size_t >( nScCol + 1 ) );
+ for (SCCOL i = aOldColSize; i <= nScCol; i++)
+ aCol[i].Init( i, nTab, pDocument, false );
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list