diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-04 18:03:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-05 09:28:27 +0200 |
commit | 80f990b8e3d05e47e041685a7811f1352d03ad4d (patch) | |
tree | 2b2c045c75544767499aea0d2b18e1890e9b9566 /stoc | |
parent | c2139cafe6240991f88b85c1df12613d0ae0e821 (diff) |
clang-tidy performance-inefficient-vector-operation
Change-Id: Iebcaea7b08c5284946d83b6b6b9ed26b218025d4
Reviewed-on: https://gerrit.libreoffice.org/59992
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/javavm/javavm.cxx | 3 | ||||
-rw-r--r-- | stoc/source/simpleregistry/simpleregistry.cxx | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index 68db4a793265..86d546462f7a 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -711,7 +711,8 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId) m_xContext); const std::vector<OUString> & props = aJvm.getProperties(); std::vector<OUString> options; - for (auto const & i: props) + options.reserve(props.size()); + for (auto const& i : props) { options.push_back(i.startsWith("-") ? i : "-D" + i); } diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx index ac520ccc58d3..0c20d6b5d0bc 100644 --- a/stoc/source/simpleregistry/simpleregistry.cxx +++ b/stoc/source/simpleregistry/simpleregistry.cxx @@ -313,7 +313,9 @@ void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const & seqValue) { osl::MutexGuard guard(registry_->mutex_); std::vector< sal_Int32 > list; - for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) { + list.reserve(seqValue.getLength()); + for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) + { list.push_back(seqValue[i]); } RegError err = key_.setLongListValue( @@ -613,7 +615,9 @@ void Key::setStringListValue( { osl::MutexGuard guard(registry_->mutex_); std::vector< sal_Unicode * > list; - for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) { + list.reserve(seqValue.getLength()); + for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) + { list.push_back(const_cast< sal_Unicode * >(seqValue[i].getStr())); } RegError err = key_.setUnicodeListValue( |