summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-02-28 14:45:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-02-28 19:03:07 +0100
commitf9845d1a2dd84e7bbc9975b3a301b5a9bd38fb4a (patch)
treee866d00867c0cd4a6b6859e17c3c48f62b075ac0 /sc
parent205e2d6c31b1861111b70a704516580761a75099 (diff)
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@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/table.hxx13
-rw-r--r--sc/source/core/data/table1.cxx8
2 files changed, 11 insertions, 10 deletions
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: */