xmlscript/source/xml_helper/xml_impctx.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
New commits: commit 44ed2efc53cb36bd5837e9d51f0922798e8ae515 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Fri Mar 7 20:18:01 2025 +0200 Commit: Noel Grandin <noelgran...@gmail.com> CommitDate: Sat Mar 8 18:31:36 2025 +0100 flatten t_OUString2PrefixMap no need to use unique_ptr indirection here Change-Id: I557e5ada59b9ff054eb2fced321bcf341e04232b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182664 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/xmlscript/source/xml_helper/xml_impctx.cxx b/xmlscript/source/xml_helper/xml_impctx.cxx index 90fbfab61c84..fc437d68dbfa 100644 --- a/xmlscript/source/xml_helper/xml_impctx.cxx +++ b/xmlscript/source/xml_helper/xml_impctx.cxx @@ -58,8 +58,7 @@ struct PrefixEntry } -typedef std::unordered_map< - OUString, std::unique_ptr<PrefixEntry> > t_OUString2PrefixMap; +typedef std::unordered_map< OUString, PrefixEntry > t_OUString2PrefixMap; namespace { @@ -225,7 +224,7 @@ inline sal_Int32 DocumentHandlerImpl::getUidByPrefix( m_prefixes.find( rPrefix ) ); if (iFind != m_prefixes.end()) { - const PrefixEntry & rPrefixEntry = *iFind->second; + const PrefixEntry & rPrefixEntry = iFind->second; SAL_WARN_IF( rPrefixEntry.m_Uids.empty(), "xmlscript.xmlhelper", "rPrefixEntry.m_Uids is empty" ); m_nLastPrefix_lookup = rPrefixEntry.m_Uids.back(); m_aLastPrefix_lookup = rPrefix; @@ -246,16 +245,16 @@ inline void DocumentHandlerImpl::pushPrefix( sal_Int32 nUid = getUidByURI( rURI ); // mark prefix with id - t_OUString2PrefixMap::const_iterator iFind( m_prefixes.find( rPrefix ) ); + t_OUString2PrefixMap::iterator iFind( m_prefixes.find( rPrefix ) ); if (iFind == m_prefixes.end()) // unused prefix { - PrefixEntry * pEntry = new PrefixEntry(); - pEntry->m_Uids.push_back( nUid ); // latest id for prefix - m_prefixes[rPrefix].reset(pEntry); + PrefixEntry aEntry; + aEntry.m_Uids.push_back( nUid ); // latest id for prefix + m_prefixes[rPrefix] = std::move(aEntry); } else { - PrefixEntry& rEntry = *iFind->second; + PrefixEntry& rEntry = iFind->second; SAL_WARN_IF(rEntry.m_Uids.empty(), "xmlscript.xmlhelper", "pEntry->m_Uids is empty"); rEntry.m_Uids.push_back(nUid); } @@ -270,7 +269,7 @@ inline void DocumentHandlerImpl::popPrefix( t_OUString2PrefixMap::iterator iFind( m_prefixes.find( rPrefix ) ); if (iFind != m_prefixes.end()) // unused prefix { - PrefixEntry& rEntry = *iFind->second; + PrefixEntry& rEntry = iFind->second; rEntry.m_Uids.pop_back(); // pop last id for prefix if (rEntry.m_Uids.empty()) // erase prefix key {