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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu May 27 18:46:39 UTC 2021


 ucb/source/ucp/file/bc.cxx     |    4 ++--
 ucb/source/ucp/file/filnot.cxx |    8 ++++----
 ucb/source/ucp/file/filnot.hxx |    4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit cd023b8f8383aae3fbb053c40949843c8a50514b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu May 27 15:46:20 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu May 27 20:45:54 2021 +0200

    no need to allocate ListenerMap on the heap
    
    it is a movable type
    
    Change-Id: I2b5c8524115016b53ec5cb28312ff4d749e27368
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116263
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx
index d85a214063ba..e79d5ba2b0b9 100644
--- a/ucb/source/ucp/file/bc.cxx
+++ b/ucb/source/ucp/file/bc.cxx
@@ -1187,13 +1187,13 @@ BaseContent::cPCL()
 
     if( seqNames.hasElements() )
     {
-        std::unique_ptr<ListenerMap> listener(new ListenerMap);
+        ListenerMap listener;
         for( const auto& rName : seqNames )
         {
             cppu::OInterfaceContainerHelper* pContainer = m_pPropertyListener->getContainer(rName);
             if (!pContainer)
                 continue;
-            (*listener)[rName] = pContainer->getElements();
+            listener[rName] = pContainer->getElements();
         }
 
         p.reset( new PropertyChangeNotifier( this, std::move(listener) ) );
diff --git a/ucb/source/ucp/file/filnot.cxx b/ucb/source/ucp/file/filnot.cxx
index 19a9d2e0b141..d1f1b830bf95 100644
--- a/ucb/source/ucp/file/filnot.cxx
+++ b/ucb/source/ucp/file/filnot.cxx
@@ -192,9 +192,9 @@ PropertySetInfoChangeNotifier::notifyPropertyRemoved( const OUString & aProperty
 
 PropertyChangeNotifier::PropertyChangeNotifier(
     const css::uno::Reference< XContent >& xCreatorContent,
-    std::unique_ptr<ListenerMap> pListeners )
+    ListenerMap&& pListeners )
     : m_xCreatorContent( xCreatorContent ),
-      m_pListeners( std::move(pListeners) )
+      m_aListeners( std::move(pListeners) )
 {
 }
 
@@ -214,7 +214,7 @@ void PropertyChangeNotifier::notifyPropertyChanged(
 
     // notify listeners for all Events
 
-    uno::Sequence< uno::Reference< uno::XInterface > > seqList = (*m_pListeners)[ OUString() ];
+    uno::Sequence< uno::Reference< uno::XInterface > > seqList = m_aListeners[ OUString() ];
     for( const auto& rListener : std::as_const(seqList) )
     {
         uno::Reference< beans::XPropertiesChangeListener > aListener( rListener,uno::UNO_QUERY );
@@ -228,7 +228,7 @@ void PropertyChangeNotifier::notifyPropertyChanged(
     for( const auto& rChange : std::as_const(Changes) )
     {
         seq[0] = rChange;
-        seqList = (*m_pListeners)[ rChange.PropertyName ];
+        seqList = m_aListeners[ rChange.PropertyName ];
 
         for( const auto& rListener : std::as_const(seqList) )
         {
diff --git a/ucb/source/ucp/file/filnot.hxx b/ucb/source/ucp/file/filnot.hxx
index 95bcc8328a48..76730c1ddcfa 100644
--- a/ucb/source/ucp/file/filnot.hxx
+++ b/ucb/source/ucp/file/filnot.hxx
@@ -83,11 +83,11 @@ namespace fileaccess {
     {
     private:
         css::uno::Reference< css::ucb::XContent > m_xCreatorContent;
-        std::unique_ptr<ListenerMap> m_pListeners;
+        ListenerMap m_aListeners;
     public:
         PropertyChangeNotifier(
             const css::uno::Reference< css::ucb::XContent >& xCreatorContent,
-            std::unique_ptr<ListenerMap> pListeners );
+            ListenerMap&& pListeners );
 
         ~PropertyChangeNotifier();
 


More information about the Libreoffice-commits mailing list