diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-06 15:03:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-06 16:28:51 +0000 |
commit | c0f69aa125081c31ca2b79e9e29e13bc91a21be7 (patch) | |
tree | 164fb2b0a6bf26ec8b4a05a58b80636eff2f56bd /unoxml | |
parent | 6c2542306bcc7caaab947664f252265058964fc2 (diff) |
no need to allocate these separately
they are all one or two words in size
Change-Id: I9bbe80a1be4d138f00d864352896d61d0df6366d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148337
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unoxml')
-rw-r--r-- | unoxml/source/dom/attr.cxx | 18 | ||||
-rw-r--r-- | unoxml/source/dom/attr.hxx | 3 | ||||
-rw-r--r-- | unoxml/source/dom/document.cxx | 2 |
3 files changed, 12 insertions, 11 deletions
diff --git a/unoxml/source/dom/attr.cxx b/unoxml/source/dom/attr.cxx index 4988aa4211ec..dd974d910edb 100644 --- a/unoxml/source/dom/attr.cxx +++ b/unoxml/source/dom/attr.cxx @@ -46,14 +46,14 @@ namespace DOM xmlNsPtr CAttr::GetNamespace(xmlNodePtr const pNode) { - if (!m_pNamespace) + if (!m_oNamespace) { return nullptr; } xmlChar const*const pUri(reinterpret_cast<xmlChar const*>( - m_pNamespace->first.getStr())); + m_oNamespace->first.getStr())); xmlChar const*const pPrefix(reinterpret_cast<xmlChar const*>( - m_pNamespace->second.getStr())); + m_oNamespace->second.getStr())); xmlNsPtr pNs = xmlSearchNs(pNode->doc, pNode, pPrefix); if (pNs && (0 != xmlStrcmp(pNs->href, pUri))) { return pNs; @@ -214,10 +214,10 @@ namespace DOM if (!m_aNodePtr) { return; } - if (m_pNamespace) + if (m_oNamespace) { OSL_ASSERT(!m_aNodePtr->parent); - m_pNamespace->second = + m_oNamespace->second = OUStringToOString(prefix, RTL_TEXTENCODING_UTF8); } else @@ -232,11 +232,11 @@ namespace DOM if (!m_aNodePtr) { return OUString(); } - if (m_pNamespace) + if (m_oNamespace) { OSL_ASSERT(!m_aNodePtr->parent); OUString const ret(OStringToOUString( - m_pNamespace->second, RTL_TEXTENCODING_UTF8)); + m_oNamespace->second, RTL_TEXTENCODING_UTF8)); return ret; } else @@ -251,11 +251,11 @@ namespace DOM if (!m_aNodePtr) { return OUString(); } - if (m_pNamespace) + if (m_oNamespace) { OSL_ASSERT(!m_aNodePtr->parent); OUString const ret(OStringToOUString( - m_pNamespace->first, RTL_TEXTENCODING_UTF8)); + m_oNamespace->first, RTL_TEXTENCODING_UTF8)); return ret; } else diff --git a/unoxml/source/dom/attr.hxx b/unoxml/source/dom/attr.hxx index f30b25896158..5c32968e2860 100644 --- a/unoxml/source/dom/attr.hxx +++ b/unoxml/source/dom/attr.hxx @@ -20,6 +20,7 @@ #pragma once #include <memory> +#include <optional> #include <libxml/tree.h> @@ -43,7 +44,7 @@ namespace DOM friend class CDocument; xmlAttrPtr m_aAttrPtr; - ::std::unique_ptr< stringpair_t > m_pNamespace; + ::std::optional< stringpair_t > m_oNamespace; CAttr(CDocument const& rDocument, ::osl::Mutex const& rMutex, xmlAttrPtr const pAttr); diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx index 413f764815e5..cb48bd1635f8 100644 --- a/unoxml/source/dom/document.cxx +++ b/unoxml/source/dom/document.cxx @@ -456,7 +456,7 @@ namespace DOM reinterpret_cast<xmlNodePtr>(pAttr)).get())); if (!pCAttr.is()) { throw RuntimeException(); } // store the namespace data! - pCAttr->m_pNamespace.reset( new stringpair_t(oUri, oPrefix) ); + pCAttr->m_oNamespace.emplace( oUri, oPrefix ); pCAttr->m_bUnlinked = true; return pCAttr; |