diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2018-09-13 22:09:43 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-15 09:06:38 +0200 |
commit | 87b24ddbba056b4887ad4613a84686ab3d2218cd (patch) | |
tree | de2b00c93611512836c30f188e59496527e2f6d8 /xmlhelp | |
parent | 7d6be61a62ca3724c67ab3fb93e60a2748d8a67e (diff) |
Simplify containers iterations in xmlhelp, xmlreader, xmlscript, xmlsecurity
Use range-based loop or replace with functions from std algorithm.
Change-Id: I5b1859da37c2a6c6e5e70602287bfc2ada951893
Reviewed-on: https://gerrit.libreoffice.org/60463
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlhelp')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.cxx | 26 | ||||
-rw-r--r-- | xmlhelp/source/treeview/tvread.cxx | 8 |
2 files changed, 10 insertions, 24 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index fa94f56a9a68..88cedb7bfefd 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -167,34 +167,20 @@ Databases::~Databases() { // DatabasesTable - DatabasesTable::iterator it = m_aDatabases.begin(); - while( it != m_aDatabases.end() ) - { - delete it->second; - ++it; - } + for (auto& rDatabase : m_aDatabases) + delete rDatabase.second; } { // ModInfoTable - - ModInfoTable::iterator it = m_aModInfo.begin(); - while( it != m_aModInfo.end() ) - { - delete it->second; - ++it; - } + for (auto& rModInfo : m_aModInfo) + delete rModInfo.second; } { // KeywordInfoTable - - KeywordInfoTable::iterator it = m_aKeywordInfo.begin(); - while( it != m_aKeywordInfo.end() ) - { - delete it->second; - ++it; - } + for (auto& rKeywordInfo : m_aKeywordInfo) + delete rKeywordInfo.second; } } diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index 2d98eb7755dd..c8006bee590f 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -503,11 +503,11 @@ TVChildTarget::SearchAndInsert(std::unique_ptr<TVDom> p, TVDom* tvDom) } else { - i = tvDom->children.begin(); - while ((i!=tvDom->children.end()) && (p != nullptr)) + for (auto& child : tvDom->children) { - p = SearchAndInsert(std::move(p), i->get()); - ++i; + p = SearchAndInsert(std::move(p), child.get()); + if (p == nullptr) + break; } return p; } |