diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-19 12:31:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-20 11:57:26 +0200 |
commit | 37d5cdef8d4678eed03909bd5459d52cd0a19ed7 (patch) | |
tree | edbb5b02ed9237d720c04cecf46d911fdd7bbdcf /xmloff/source | |
parent | 4f025026a995eaf91c288d0698a998ed2b515dac (diff) |
no need to allocate Sequence separately in FilterPropertiesInfo_Impl
Change-Id: I8a10d2c0a31624cfefa485ae1a7d080f96d2b83e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119218
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/style/xmlexppr.cxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx index aeda6e081405..44bab345afe2 100644 --- a/xmloff/source/style/xmlexppr.cxx +++ b/xmloff/source/style/xmlexppr.cxx @@ -18,6 +18,7 @@ */ #include <memory> +#include <optional> #include <string_view> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/xml/AttributeData.hpp> @@ -158,7 +159,7 @@ class FilterPropertiesInfo_Impl { FilterPropertyInfoList_Impl aPropInfos; - std::unique_ptr<Sequence<OUString>> pApiNames; + std::optional<Sequence<OUString>> mxApiNames; public: FilterPropertiesInfo_Impl(); @@ -183,13 +184,13 @@ void FilterPropertiesInfo_Impl::AddProperty( { aPropInfos.emplace_back(rApiName, nIndex); - OSL_ENSURE( !pApiNames, "performance warning: API names already retrieved" ); - pApiNames.reset(); + OSL_ENSURE( !mxApiNames, "performance warning: API names already retrieved" ); + mxApiNames.reset(); } const uno::Sequence<OUString>& FilterPropertiesInfo_Impl::GetApiNames() { - if( !pApiNames ) + if( !mxApiNames ) { // we have to do three things: // 1) sort API names, @@ -232,8 +233,8 @@ const uno::Sequence<OUString>& FilterPropertiesInfo_Impl::GetApiNames() } // construct sequence - pApiNames.reset( new Sequence < OUString >( aPropInfos.size() ) ); - OUString *pNames = pApiNames->getArray(); + mxApiNames.emplace( aPropInfos.size() ); + OUString *pNames = mxApiNames->getArray(); for (auto const& propInfo : aPropInfos) { @@ -242,7 +243,7 @@ const uno::Sequence<OUString>& FilterPropertiesInfo_Impl::GetApiNames() } } - return *pApiNames; + return *mxApiNames; } void FilterPropertiesInfo_Impl::FillPropertyStateArray( |