summaryrefslogtreecommitdiff
path: root/framework/source/services/pathsettings.cxx
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-02-16 18:39:23 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-02-18 07:41:05 +0100
commit44841a6778821be3e68ab15819b39064b20e968f (patch)
tree8e9119cf35764f18f5b008e7758c6f950306fb8c /framework/source/services/pathsettings.cxx
parentbcfbd24be02d2de5d4d27c147dc58c4515a9a0f5 (diff)
Simplify containers iterations in [f-l]*
Use range-based loop or replace with STL functions Change-Id: Ib3fab47318d1bfbb4df8f886a8cd9596525a420f Reviewed-on: https://gerrit.libreoffice.org/67914 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/source/services/pathsettings.cxx')
-rw-r--r--framework/source/services/pathsettings.cxx21
1 files changed, 5 insertions, 16 deletions
diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx
index 070d62a6752b..74831fa22d79 100644
--- a/framework/source/services/pathsettings.cxx
+++ b/framework/source/services/pathsettings.cxx
@@ -999,8 +999,6 @@ std::vector<OUString> PathSettings::impl_convertOldStyle2Path(const OUString& sO
void PathSettings::impl_purgeKnownPaths(PathSettings::PathInfo& rPath,
std::vector<OUString>& lList)
{
- std::vector<OUString>::iterator pIt;
-
// Erase items in the internal path list from lList.
// Also erase items in the internal path list from the user path list.
for (auto const& internalPath : rPath.lInternalPaths)
@@ -1014,20 +1012,11 @@ void PathSettings::impl_purgeKnownPaths(PathSettings::PathInfo& rPath,
}
// Erase items not in lList from the user path list.
- pIt = rPath.lUserPaths.begin();
- while ( pIt != rPath.lUserPaths.end() )
- {
- const OUString& rItem = *pIt;
- std::vector<OUString>::iterator pItem = std::find(lList.begin(), lList.end(), rItem);
- if ( pItem == lList.end() )
- {
- pIt = rPath.lUserPaths.erase(pIt);
- }
- else
- {
- ++pIt;
- }
- }
+ rPath.lUserPaths.erase(std::remove_if(rPath.lUserPaths.begin(), rPath.lUserPaths.end(),
+ [&lList](const OUString& rItem) {
+ return std::find(lList.begin(), lList.end(), rItem) == lList.end();
+ }),
+ rPath.lUserPaths.end());
// Erase items in the user path list from lList.
for (auto const& userPath : rPath.lUserPaths)