[Libreoffice-commits] core.git: configmgr/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 11 07:59:54 UTC 2021


 configmgr/source/childaccess.cxx |    6 +++---
 configmgr/source/childaccess.hxx |    3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit da40449dc5f1841ac3e6f6aa1194834a363455b6
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Tue Aug 10 20:01:50 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Aug 11 09:59:17 2021 +0200

    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 at collabora.co.uk>

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_;


More information about the Libreoffice-commits mailing list