summaryrefslogtreecommitdiff
path: root/configmgr
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-08-10 20:01:50 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-11 09:59:17 +0200
commitda40449dc5f1841ac3e6f6aa1194834a363455b6 (patch)
tree5e8dbd7c20533b13c91b2be8e431454747ed8682 /configmgr
parent0c4cdfa9c9ba9548a61c7314858eae01f90f2782 (diff)
no need to allocate changedValue_ separately
Change-Id: Ibda7c7a055790f6eb87ac6bd62554e745181cea7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120292 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'configmgr')
-rw-r--r--configmgr/source/childaccess.cxx6
-rw-r--r--configmgr/source/childaccess.hxx3
2 files changed, 5 insertions, 4 deletions
diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx
index 41636b0e1bbe..ecaae9f522e5 100644
--- a/configmgr/source/childaccess.cxx
+++ b/configmgr/source/childaccess.cxx
@@ -236,14 +236,14 @@ void ChildAccess::setProperty(
}
checkValue(value, type, isNillable);
getParentAccess()->markChildAsModified(this);
- changedValue_.reset(new css::uno::Any(value));
+ changedValue_.emplace(value);
localModifications->add(getRelativePath());
}
css::uno::Any ChildAccess::asValue()
{
- if (changedValue_ != nullptr)
+ if (changedValue_)
{
return *changedValue_;
}
@@ -287,7 +287,7 @@ void ChildAccess::commitChanges(bool valid, Modifications * globalModifications)
{
assert(globalModifications != nullptr);
commitChildChanges(valid, globalModifications);
- if (valid && changedValue_ != nullptr)
+ if (valid && changedValue_)
{
std::vector<OUString> path(getAbsolutePath());
getComponents().addModification(path);
diff --git a/configmgr/source/childaccess.hxx b/configmgr/source/childaccess.hxx
index 2aecdf6757ea..2c0eabfcaa4e 100644
--- a/configmgr/source/childaccess.hxx
+++ b/configmgr/source/childaccess.hxx
@@ -22,6 +22,7 @@
#include <sal/config.h>
#include <memory>
+#include <optional>
#include <vector>
#include <com/sun/star/container/XChild.hpp>
@@ -125,7 +126,7 @@ private:
rtl::Reference< Access > parent_; // null if free node
OUString name_;
rtl::Reference< Node > node_;
- std::unique_ptr< css::uno::Any > changedValue_;
+ std::optional< css::uno::Any > changedValue_;
bool inTransaction_;
// to determine if a free node can be inserted underneath some root
std::shared_ptr<osl::Mutex> lock_;