summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-10-14 09:25:24 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-15 10:36:36 +0200
commit2484de6728bd11bb7949003d112f1ece2223c7a1 (patch)
tree1296534e396da284b38d2c478dcd2b31c4714179 /extensions
parentNoOp refactor to make elif clearer (diff)
downloadcore-2484de6728bd11bb7949003d112f1ece2223c7a1.tar.gz
core-2484de6728bd11bb7949003d112f1ece2223c7a1.zip
Remove non-const Sequence::begin()/end() in internal code
... to avoid hidden cost of multiple COW checks, because they call getArray() internally. This obsoletes [loplugin:sequenceloop]. Also rename toNonConstRange to asNonConstRange, to reflect that the result is a view of the sequence, not an independent object. TODO: also drop non-const operator[], but introduce operator[] in SequenceRange. Change-Id: Idd5fd7a3400fe65274d2a6343025e2ef8911635d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123518 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx2
-rw-r--r--extensions/source/propctrlr/stringrepresentation.cxx2
2 files changed, 2 insertions, 2 deletions
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index a005a33e7019..bf3feb4acb1a 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -814,7 +814,7 @@ namespace pcr
PropertyId nPropId( 0 );
OUString sDisplayName;
- for ( Property & rProperty : aAllProperties )
+ for ( Property & rProperty : asNonConstRange(aAllProperties) )
{
nPropId = m_pInfoService->getPropertyId( rProperty.Name );
if ( nPropId == -1 )
diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx
index 073cbbedd130..da468e5b51ef 100644
--- a/extensions/source/propctrlr/stringrepresentation.cxx
+++ b/extensions/source/propctrlr/stringrepresentation.cxx
@@ -255,7 +255,7 @@ void SAL_CALL StringRepresentation::initialize(const uno::Sequence< uno::Any > &
uno::Sequence<
uno::Reference< reflection::XConstantTypeDescription > >
cs(m_xTypeDescription->getConstants());
- auto [begin, end] = toNonConstRange(cs);
+ auto [begin, end] = asNonConstRange(cs);
std::sort(begin, end, CompareConstants());
m_aConstants = cs;
}