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 /extensions/source/inc/componentmodule.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 'extensions/source/inc/componentmodule.cxx')
-rw-r--r-- | extensions/source/inc/componentmodule.cxx | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/extensions/source/inc/componentmodule.cxx b/extensions/source/inc/componentmodule.cxx index 92f7bb45cc1c..18f589c77ccc 100644 --- a/extensions/source/inc/componentmodule.cxx +++ b/extensions/source/inc/componentmodule.cxx @@ -91,17 +91,14 @@ namespace compmodule && (s_pImplementationNames->size() == s_pFactoryFunctionPointers->size()), "OModule::revokeComponent : inconsistent state !"); - sal_Int32 nLen = s_pImplementationNames->size(); - for (sal_Int32 i=0; i<nLen; ++i) + auto it = std::find(s_pImplementationNames->begin(), s_pImplementationNames->end(), _rImplementationName); + if (it != s_pImplementationNames->end()) { - if ((*s_pImplementationNames)[i] == _rImplementationName) - { - s_pImplementationNames->erase(s_pImplementationNames->begin() + i); - s_pSupportedServices->erase(s_pSupportedServices->begin() + i); - s_pCreationFunctionPointers->erase(s_pCreationFunctionPointers->begin() + i); - s_pFactoryFunctionPointers->erase(s_pFactoryFunctionPointers->begin() + i); - break; - } + sal_Int32 i = static_cast<sal_Int32>(std::distance(s_pImplementationNames->begin(), it)); + s_pImplementationNames->erase(it); + s_pSupportedServices->erase(s_pSupportedServices->begin() + i); + s_pCreationFunctionPointers->erase(s_pCreationFunctionPointers->begin() + i); + s_pFactoryFunctionPointers->erase(s_pFactoryFunctionPointers->begin() + i); } if (s_pImplementationNames->empty()) |