include/xmloff/namespacemap.hxx | 2 ++ xmloff/source/core/namespacemap.cxx | 9 +++++++++ xmloff/source/core/xmlexp.cxx | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-)
New commits: commit d01f8813084b245492c83cf750bb59bcd2659621 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu May 12 15:19:27 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri May 13 14:00:06 2022 +0200 tdf#121740 cheaper to clear namespacemap rather than allocating a new one Change-Id: I413de3a61744400f5582f7e090c161ea21bf0b0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134267 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/xmloff/namespacemap.hxx b/include/xmloff/namespacemap.hxx index c9f4e71fd876..361ddfb7311d 100644 --- a/include/xmloff/namespacemap.hxx +++ b/include/xmloff/namespacemap.hxx @@ -122,6 +122,8 @@ public: This might be replaced by a better interface later. */ const NameSpaceHash& GetAllEntries() const { return aNameHash; } + void Clear(); + static bool NormalizeOasisURN( OUString& rName ); static bool NormalizeW3URI( OUString& rName ); static bool NormalizeURI( OUString& rName ); diff --git a/xmloff/source/core/namespacemap.cxx b/xmloff/source/core/namespacemap.cxx index 9fdce6e3cc16..3e28a4437cc2 100644 --- a/xmloff/source/core/namespacemap.cxx +++ b/xmloff/source/core/namespacemap.cxx @@ -75,6 +75,15 @@ SvXMLNamespaceMap::~SvXMLNamespaceMap() { } +void SvXMLNamespaceMap::Clear() +{ + aNameHash.clear(); + aNameCache.clear(); + aNameMap.clear(); + aQNameCache.clear(); +} + + bool SvXMLNamespaceMap::operator ==( const SvXMLNamespaceMap& rCmp ) const { return aNameHash == rCmp.aNameHash; diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 22b55d7565f5..7c2291156852 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -1406,7 +1406,7 @@ ErrCode SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) void SvXMLExport::ResetNamespaceMap() { - mpNamespaceMap.reset( new SvXMLNamespaceMap ); + mpNamespaceMap->Clear(); } OUString const & SvXMLExport::GetSourceShellID() const