diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2019-10-06 12:51:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-06 18:51:37 +0200 |
commit | 4b28b77eddfe48e709180f1ab81ac0d996796471 (patch) | |
tree | cea69cf628cd91d55e42afaf712b5bae4c0755a2 /xmlreader | |
parent | 0a6b9df8c8fc8e97ac627081485613e336051208 (diff) |
we can use Span for the cache key here
Change-Id: I77894e3c5e3d68cb2a12abcc0b09f2c042664ba0
Reviewed-on: https://gerrit.libreoffice.org/80315
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlreader')
-rw-r--r-- | xmlreader/source/span.cxx | 4 | ||||
-rw-r--r-- | xmlreader/source/xmlreader.cxx | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/xmlreader/source/span.cxx b/xmlreader/source/span.cxx index 29433c561fb7..300c0a2e99b3 100644 --- a/xmlreader/source/span.cxx +++ b/xmlreader/source/span.cxx @@ -46,6 +46,10 @@ OUString Span::convertFromUtf8() const { return OUString(s, SAL_NO_ACQUIRE); } +std::size_t Span::hashCode() const { + return rtl_str_hashCode_WithLength(begin, length); +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlreader/source/xmlreader.cxx b/xmlreader/source/xmlreader.cxx index 0194f6c695a7..95a27a785b5c 100644 --- a/xmlreader/source/xmlreader.cxx +++ b/xmlreader/source/xmlreader.cxx @@ -182,9 +182,7 @@ Span XmlReader::getAttributeValue(bool fullyNormalize) { } int XmlReader::getNamespaceId(Span const & prefix) const { - OUString spanString = prefix.convertFromUtf8(); - - if (auto it = cacheNSIds_.find(spanString); it != cacheNSIds_.end()) + if (auto it = cacheNSIds_.find(prefix); it != cacheNSIds_.end()) { return it->second; } @@ -194,7 +192,7 @@ int XmlReader::getNamespaceId(Span const & prefix) const { if (i != namespaces_.rend()) { - cacheNSIds_[spanString]= i->nsId; + cacheNSIds_[i->prefix]= i->nsId; return i->nsId; } |