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 /xmlreader | |
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 'xmlreader')
-rw-r--r-- | xmlreader/source/xmlreader.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/xmlreader/source/xmlreader.cxx b/xmlreader/source/xmlreader.cxx index 699567a53a32..58f3ec88ebb6 100644 --- a/xmlreader/source/xmlreader.cxx +++ b/xmlreader/source/xmlreader.cxx @@ -184,13 +184,12 @@ Span XmlReader::getAttributeValue(bool fullyNormalize) { } int XmlReader::getNamespaceId(Span const & prefix) const { - for (NamespaceList::const_reverse_iterator i(namespaces_.rbegin()); - i != namespaces_.rend(); ++i) - { - if (prefix.equals(i->prefix)) { - return i->nsId; - } - } + auto i = std::find_if(namespaces_.crbegin(), namespaces_.crend(), + [&prefix](const NamespaceData& rNamespaceData) { return prefix.equals(rNamespaceData.prefix); }); + + if (i != namespaces_.rend()) + return i->nsId; + return NAMESPACE_UNKNOWN; } |