diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-27 13:37:45 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-27 14:58:12 +0200 |
commit | 2d0eea0a79df9bc54e075c90ee7d6134b03250c0 (patch) | |
tree | 49ce2fc8748523bad37626f2eef3bf336ea5b926 /xmloff | |
parent | 01df224f574c5a7788df0f2aea3345166d6ce250 (diff) |
we can search std::set without allocating on the heap
we just need to add some overloads to UniquePtrValueLess
Change-Id: I91c395393a2de609c8f442de605d1dd2098dfae0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116248
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/style/impastpl.cxx | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/xmloff/source/style/impastpl.cxx b/xmloff/source/style/impastpl.cxx index 0a3e2e97595f..b965b7a5a8f8 100644 --- a/xmloff/source/style/impastpl.cxx +++ b/xmloff/source/style/impastpl.cxx @@ -367,8 +367,8 @@ void SvXMLAutoStylePoolP_Impl::AddFamily( } #if OSL_DEBUG_LEVEL > 0 - std::unique_ptr<XMLAutoStyleFamily> pTemp(new XMLAutoStyleFamily(nFamily)); - auto const iter = m_FamilySet.find(pTemp); + XMLAutoStyleFamily aTemp(nFamily); + auto const iter = m_FamilySet.find(aTemp); if (iter != m_FamilySet.end()) { // FIXME: do we really intend to replace the previous nFamily @@ -388,8 +388,8 @@ void SvXMLAutoStylePoolP_Impl::SetFamilyPropSetMapper( XmlStyleFamily nFamily, const rtl::Reference < SvXMLExportPropertyMapper > & rMapper ) { - std::unique_ptr<XMLAutoStyleFamily> pTemp(new XMLAutoStyleFamily(nFamily)); - auto const iter = m_FamilySet.find(pTemp); + XMLAutoStyleFamily aTemp(nFamily); + auto const iter = m_FamilySet.find(aTemp); if (iter != m_FamilySet.end()) (*iter)->mxMapper = rMapper; } @@ -397,8 +397,8 @@ void SvXMLAutoStylePoolP_Impl::SetFamilyPropSetMapper( // Adds a name to list void SvXMLAutoStylePoolP_Impl::RegisterName( XmlStyleFamily nFamily, const OUString& rName ) { - std::unique_ptr<XMLAutoStyleFamily> pTemp(new XMLAutoStyleFamily(nFamily)); - auto const iter = m_FamilySet.find(pTemp); + XMLAutoStyleFamily aTemp(nFamily); + auto const iter = m_FamilySet.find(aTemp); assert(iter != m_FamilySet.end()); // family must be known // SAL_DEBUG("SvXMLAutoStylePoolP_Impl::RegisterName: " << nFamily << ", '" << rName << "'"); (*iter)->maNameSet.insert(rName); @@ -407,8 +407,8 @@ void SvXMLAutoStylePoolP_Impl::RegisterName( XmlStyleFamily nFamily, const OUStr // Adds a name to list void SvXMLAutoStylePoolP_Impl::RegisterDefinedName( XmlStyleFamily nFamily, const OUString& rName ) { - std::unique_ptr<XMLAutoStyleFamily> pTemp(new XMLAutoStyleFamily(nFamily)); - auto const iter = m_FamilySet.find(pTemp); + XMLAutoStyleFamily aTemp(nFamily); + auto const iter = m_FamilySet.find(aTemp); assert(iter != m_FamilySet.end()); // family must be known (*iter)->maReservedNameSet.insert(rName); } @@ -455,8 +455,8 @@ bool SvXMLAutoStylePoolP_Impl::Add( OUString& rName, XmlStyleFamily nFamily, const OUString& rParentName, const ::std::vector< XMLPropertyState >& rProperties, bool bDontSeek ) { - std::unique_ptr<XMLAutoStyleFamily> pTemp(new XMLAutoStyleFamily(nFamily)); - auto const iter = m_FamilySet.find(pTemp); + XMLAutoStyleFamily aTemp(nFamily); + auto const iter = m_FamilySet.find(aTemp); assert(iter != m_FamilySet.end()); // family must be known XMLAutoStyleFamily &rFamily = **iter; @@ -481,8 +481,8 @@ bool SvXMLAutoStylePoolP_Impl::AddNamed( { // get family and parent the same way as in Add() - std::unique_ptr<XMLAutoStyleFamily> pTemp(new XMLAutoStyleFamily(nFamily)); - auto const iter = m_FamilySet.find(pTemp); + XMLAutoStyleFamily aTemp(nFamily); + auto const iter = m_FamilySet.find(aTemp); assert(iter != m_FamilySet.end()); // family must be known XMLAutoStyleFamily &rFamily = **iter; @@ -511,13 +511,13 @@ OUString SvXMLAutoStylePoolP_Impl::Find( XmlStyleFamily nFamily, { OUString sName; - std::unique_ptr<XMLAutoStyleFamily> pTemp(new XMLAutoStyleFamily(nFamily)); - auto const iter = m_FamilySet.find(pTemp); + XMLAutoStyleFamily aTemp(nFamily); + auto const iter = m_FamilySet.find(aTemp); assert(iter != m_FamilySet.end()); // family must be known XMLAutoStyleFamily const& rFamily = **iter; - std::unique_ptr<XMLAutoStylePoolParent> pTmp(new XMLAutoStylePoolParent(rParent)); - auto const it2 = rFamily.m_ParentSet.find(pTmp); + XMLAutoStylePoolParent aTmp(rParent); + auto const it2 = rFamily.m_ParentSet.find(aTmp); if (it2 != rFamily.m_ParentSet.end()) { sName = (*it2)->Find(rFamily, rProperties); @@ -579,8 +579,8 @@ void SvXMLAutoStylePoolP_Impl::exportXML( const SvXMLAutoStylePoolP *pAntiImpl) const { // Get list of parents for current family (nFamily) - std::unique_ptr<XMLAutoStyleFamily> pTemp(new XMLAutoStyleFamily(nFamily)); - auto const iter = m_FamilySet.find(pTemp); + XMLAutoStyleFamily aTemp(nFamily); + auto const iter = m_FamilySet.find(aTemp); assert(iter != m_FamilySet.end()); // family must be known const XMLAutoStyleFamily &rFamily = **iter; |