summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-04-18 15:13:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-04-19 13:19:31 +0200
commit1a5b12aa5da2c718848d3cc5d9bce7bfcdeacf54 (patch)
tree25044edc2afb99073ba6bef8d181dadbb6a53467 /ucb
parenteaaaad0e21edb27edaa865eee03696f007cd8010 (diff)
optimise find/insert pattern
if we're doing a find/insert on a set or a map, it is better to just do a conditional insert/emplace operation than triggering two lookups. Change-Id: I80da5097f5a89fe30fa348ce5b6e747c34287a8d Reviewed-on: https://gerrit.libreoffice.org/70937 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/file/filtask.cxx3
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx8
-rw-r--r--ucb/source/ucp/webdav/webdavcontentcaps.cxx8
3 files changed, 3 insertions, 16 deletions
diff --git a/ucb/source/ucp/file/filtask.cxx b/ucb/source/ucp/file/filtask.cxx
index 941c6d36634b..1930d8cc5f07 100644
--- a/ucb/source/ucp/file/filtask.cxx
+++ b/ucb/source/ucp/file/filtask.cxx
@@ -2224,8 +2224,7 @@ TaskManager::load( const ContentMap::iterator& it, bool create )
xS->getPropertyValue( seq[i].Name ),
beans::PropertyState_DIRECT_VALUE,
seq[i].Attributes );
- if( properties.find( readProp ) == properties.end() )
- properties.insert( readProp );
+ properties.insert( readProp );
}
}
else if( create )
diff --git a/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx b/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx
index e650085d6229..34daa30b9d09 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx
@@ -491,17 +491,11 @@ uno::Sequence< beans::Property > Content::getProperties(
// Add cached properties, if present and still missing.
if (xCachedProps)
{
- const std::set< OUString >::const_iterator set_end
- = aPropSet.end();
-
const std::unique_ptr< PropertyValueMap > & xProps
= xCachedProps->getProperties();
for ( const auto& rEntry : *xProps )
- {
- if ( aPropSet.find( rEntry.first ) == set_end )
- aPropSet.insert( rEntry.first );
- }
+ aPropSet.insert( rEntry.first );
}
// std::set -> uno::Sequence
diff --git a/ucb/source/ucp/webdav/webdavcontentcaps.cxx b/ucb/source/ucp/webdav/webdavcontentcaps.cxx
index 20a2c11ff770..d0e3558de51a 100644
--- a/ucb/source/ucp/webdav/webdavcontentcaps.cxx
+++ b/ucb/source/ucp/webdav/webdavcontentcaps.cxx
@@ -440,17 +440,11 @@ uno::Sequence< beans::Property > Content::getProperties(
// Add cached properties, if present and still missing.
if ( xCachedProps.get() )
{
- const std::set< OUString >::const_iterator set_end
- = aPropSet.end();
-
const std::unique_ptr< PropertyValueMap > & xProps
= xCachedProps->getProperties();
for ( const auto& rEntry : *xProps )
- {
- if ( aPropSet.find( rEntry.first ) == set_end )
- aPropSet.insert( rEntry.first );
- }
+ aPropSet.insert( rEntry.first );
}
// std::set -> uno::Sequence