summaryrefslogtreecommitdiff
path: root/unoxml
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-04-18 15:13:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-04-19 13:19:31 +0200
commit1a5b12aa5da2c718848d3cc5d9bce7bfcdeacf54 (patch)
tree25044edc2afb99073ba6bef8d181dadbb6a53467 /unoxml
parenteaaaad0e21edb27edaa865eee03696f007cd8010 (diff)
optimise find/insert pattern
if we're doing a find/insert on a set or a map, it is better to just do a conditional insert/emplace operation than triggering two lookups. Change-Id: I80da5097f5a89fe30fa348ce5b6e747c34287a8d Reviewed-on: https://gerrit.libreoffice.org/70937 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unoxml')
-rw-r--r--unoxml/source/xpath/xpathapi.cxx5
1 files changed, 1 insertions, 4 deletions
diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx
index 9fa2e6fd2cad..415f565d3ae0 100644
--- a/unoxml/source/xpath/xpathapi.cxx
+++ b/unoxml/source/xpath/xpathapi.cxx
@@ -149,10 +149,7 @@ namespace XPath
const xmlChar* pPre = curDef->prefix;
OUString aPrefix(reinterpret_cast<char const *>(pPre), strlen(reinterpret_cast<char const *>(pPre)), RTL_TEXTENCODING_UTF8);
// we could already have this prefix from a child node
- if (rNamespaces.find(aPrefix) == rNamespaces.end())
- {
- rNamespaces.insert(::std::make_pair(aPrefix, aURI));
- }
+ rNamespaces.emplace(aPrefix, aURI);
curDef = curDef->next;
}
pNode = pNode->parent;