[Libreoffice-commits] core.git: 2 commits - connectivity/source include/vcl

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 18 07:02:45 UTC 2019


 connectivity/source/drivers/jdbc/JConnection.cxx |   26 +++++++----------------
 include/vcl/headbar.hxx                          |    3 --
 2 files changed, 8 insertions(+), 21 deletions(-)

New commits:
commit 14824e73d8be8dfe3f26880d805dde58418a4835
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Dec 17 15:21:06 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Dec 18 08:01:16 2019 +0100

    loplugin:duplicate-defines
    
    already defined inside the .cxx file, so just delete the one in the .hxx
    file
    
    Change-Id: I2b8eb1dde1365276ef0cddb89d6016348708f5e6
    Reviewed-on: https://gerrit.libreoffice.org/85338
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/vcl/headbar.hxx b/include/vcl/headbar.hxx
index 2afc2049cf7d..162ebd2acfec 100644
--- a/include/vcl/headbar.hxx
+++ b/include/vcl/headbar.hxx
@@ -201,9 +201,6 @@ namespace o3tl
 #define HEADERBAR_ITEM_NOTFOUND     (sal_uInt16(0xFFFF))
 #define HEADERBAR_FULLSIZE          (long(1000000000))
 
-#define HEADERBAR_TEXTOFF           2
-
-
 class VCL_DLLPUBLIC HeaderBar : public vcl::Window
 {
 private:
commit 6526b72434e5f4097229629e12d9ab958edfafc4
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Dec 17 14:05:58 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Dec 18 08:00:44 2019 +0100

    Elide use of rtl_Instance (which is obsoleted by C++11 thread-safe statics)
    
    Change-Id: I34f801d1d56868b89027f10e0567004f1b8a4cc7
    Reviewed-on: https://gerrit.libreoffice.org/85331
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx
index e9109a7d7e0f..bc2e2ad18d66 100644
--- a/connectivity/source/drivers/jdbc/JConnection.cxx
+++ b/connectivity/source/drivers/jdbc/JConnection.cxx
@@ -79,13 +79,6 @@ struct ClassMapData {
     ClassMap map;
 };
 
-struct ClassMapDataInit {
-    ClassMapData * operator()() {
-        static ClassMapData instance;
-        return &instance;
-    }
-};
-
 template < typename T >
 bool getLocalFromWeakRef( jweak& _weak, LocalRef< T >& _inout_local )
 {
@@ -133,17 +126,14 @@ bool loadClass(
     OSL_ASSERT(classLoaderPtr != nullptr);
     // For any jweak entries still present in the map upon destruction,
     // DeleteWeakGlobalRef is not called (which is a leak):
-    ClassMapData * d =
-        rtl_Instance< ClassMapData, ClassMapDataInit, osl::MutexGuard,
-        osl::GetGlobalMutex >::create(
-            ClassMapDataInit(), osl::GetGlobalMutex());
-    osl::MutexGuard g(d->mutex);
-    ClassMap::iterator i(d->map.begin());
+    static ClassMapData classMapData;
+    osl::MutexGuard g(classMapData.mutex);
+    ClassMap::iterator i(classMapData.map.begin());
     LocalRef< jobject > cloader(environment);
     LocalRef< jclass > cl(environment);
     // Prune dangling weak references from the list while searching for a match,
     // so that the list cannot grow unbounded:
-    for (; i != d->map.end();)
+    for (; i != classMapData.map.end();)
     {
         LocalRef< jobject > classLoader( environment );
         if ( !getLocalFromWeakRef( i->classLoader, classLoader ) )
@@ -155,7 +145,7 @@ bool loadClass(
 
         if ( !classLoader.is() && !classObject.is() )
         {
-            i = d->map.erase(i);
+            i = classMapData.map.erase(i);
         }
         else if ( i->classPath == classPath && i->className == name )
         {
@@ -170,7 +160,7 @@ bool loadClass(
     }
     if ( !cloader.is() || !cl.is() )
     {
-        if ( i == d->map.end() )
+        if ( i == classMapData.map.end() )
         {
             // Push a new ClassMapEntry (which can potentially fail) before
             // loading the class, so that it never happens that a class is
@@ -178,8 +168,8 @@ bool loadClass(
             // JVM that are not easily undone).  If the pushed ClassMapEntry is
             // not used after all (return false, etc.) it will be pruned on next
             // call because its classLoader/classObject are null:
-            d->map.push_back( ClassMapEntry( classPath, name ) );
-            i = std::prev(d->map.end());
+            classMapData.map.push_back( ClassMapEntry( classPath, name ) );
+            i = std::prev(classMapData.map.end());
         }
 
         LocalRef< jclass > clClass( environment );


More information about the Libreoffice-commits mailing list