diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-02-20 01:10:07 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-20 07:17:38 +0100 |
commit | 6a143985bdc5d12d1f9e8cf8592440282986c099 (patch) | |
tree | 346e09d6ba1146b52a6a484a2883f3e898184648 /desktop/source/migration/migration.cxx | |
parent | d707a5e64ba53ddb7669cca725915527aa788a6b (diff) |
Simplify containers iterations in desktop, dtrans, editeng, extensions
Use range-based loop or replace with STL functions
Change-Id: Ic5389d123d0a6a32a8bb46b081165e94a7c55292
Reviewed-on: https://gerrit.libreoffice.org/68036
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop/source/migration/migration.cxx')
-rw-r--r-- | desktop/source/migration/migration.cxx | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index bea253cb5c96..7a4476f69319 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -337,18 +337,11 @@ bool MigrationImpl::checkMigrationCompleted() static void insertSorted(migrations_available& rAvailableMigrations, supported_migration const & aSupportedMigration) { - bool bInserted( false ); - migrations_available::iterator pIter = rAvailableMigrations.begin(); - while (pIter != rAvailableMigrations.end()) - { - if ( pIter->nPriority < aSupportedMigration.nPriority ) { - rAvailableMigrations.insert(pIter, aSupportedMigration ); - bInserted = true; - break; // i111193: insert invalidates iterator! - } - ++pIter; - } - if ( !bInserted ) + migrations_available::iterator pIter = std::find_if(rAvailableMigrations.begin(), rAvailableMigrations.end(), + [&aSupportedMigration](const supported_migration& rMigration) { return rMigration.nPriority < aSupportedMigration.nPriority; }); + if (pIter != rAvailableMigrations.end()) + rAvailableMigrations.insert(pIter, aSupportedMigration ); + else rAvailableMigrations.push_back( aSupportedMigration ); } |