[Libreoffice-commits] .: 3 commits - starmath/source sw/source

Caolán McNamara caolan at kemper.freedesktop.org
Mon Apr 4 06:31:21 PDT 2011


 starmath/source/mathmlexport.cxx |   19 +++++++------------
 starmath/source/mathmlimport.cxx |   19 +++++++------------
 starmath/source/smdetect.cxx     |    1 -
 sw/source/ui/uno/swdetect.cxx    |    1 -
 4 files changed, 14 insertions(+), 26 deletions(-)

New commits:
commit 8d279fcb63e336d64c799c27214b1123713a66c0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 4 12:23:43 2011 +0100

    use rtl::Static where double-locked pattern used

diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 1335012..80b1832 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -72,6 +72,7 @@
 #include <xmloff/xmlmetai.hxx>
 #include <osl/mutex.hxx>
 #include <comphelper/genericpropertyset.hxx>
+#include <comphelper/servicehelper.hxx>
 
 #include <memory>
 
@@ -408,20 +409,14 @@ throw(uno::RuntimeException)
     return SvXMLExport::getSomething( rId );
 }
 
+namespace
+{
+    class theSmXMLExportUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSmXMLExportUnoTunnelId> {};
+}
+
 const uno::Sequence< sal_Int8 > & SmXMLExport::getUnoTunnelId() throw()
 {
-    static uno::Sequence< sal_Int8 > * pSeq = 0;
-    if ( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theSmXMLExportUnoTunnelId::get().getSeq();
 }
 
 OUString SAL_CALL SmXMLExport_getImplementationName() throw()
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index e28d8e8..b2a673d 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -68,6 +68,7 @@ one go*/
 #include <xmloff/xmlmetai.hxx>
 #include <osl/mutex.hxx>
 #include <comphelper/genericpropertyset.hxx>
+#include <comphelper/servicehelper.hxx>
 
 #include <memory>
 
@@ -436,20 +437,14 @@ SmXMLImport::SmXMLImport(
 {
 }
 
+namespace
+{
+    class theSmXMLImportUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSmXMLImportUnoTunnelId> {};
+}
+
 const uno::Sequence< sal_Int8 > & SmXMLImport::getUnoTunnelId() throw()
 {
-    static uno::Sequence< sal_Int8 > * pSeq = 0;
-    if ( !pSeq )
-    {
-        osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-        if ( !pSeq )
-        {
-            static uno::Sequence< sal_Int8 > aSeq( 16 );
-            rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-            pSeq = &aSeq;
-        }
-    }
-    return *pSeq;
+    return theSmXMLImportUnoTunnelId::get().getSeq();
 }
 
 OUString SAL_CALL SmXMLImport_getImplementationName() throw()
commit 9a43978fbe90546582099b4eb54ec15d36f98573
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 4 12:20:20 2011 +0100

    that's a completely pointless getGlobalMutex acquisition

diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx
index ca50ad3..13f2324 100644
--- a/starmath/source/smdetect.cxx
+++ b/starmath/source/smdetect.cxx
@@ -455,7 +455,6 @@ UNOSEQUENCE< UNOOUSTRING > SAL_CALL SmFilterDetect::getSupportedServiceNames() t
 /* Helper for XServiceInfo */
 UNOSEQUENCE< UNOOUSTRING > SmFilterDetect::impl_getStaticSupportedServiceNames()
 {
-    UNOMUTEXGUARD aGuard( UNOMUTEX::getGlobalMutex() );
     UNOSEQUENCE< UNOOUSTRING > seqServiceNames( 1 );
     seqServiceNames.getArray() [0] = UNOOUSTRING(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ExtendedTypeDetection"  ));
     return seqServiceNames ;
commit 928b3f7440dc52614f19a5962143800711ba0837
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 4 11:58:58 2011 +0100

    that's a completely pointless getGlobalMutex acquisition

diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx
index 601bd43..320d59a 100644
--- a/sw/source/ui/uno/swdetect.cxx
+++ b/sw/source/ui/uno/swdetect.cxx
@@ -455,7 +455,6 @@ UNOSEQUENCE< UNOOUSTRING > SAL_CALL SwFilterDetect::getSupportedServiceNames() t
 /* Helper for XServiceInfo */
 UNOSEQUENCE< UNOOUSTRING > SwFilterDetect::impl_getStaticSupportedServiceNames()
 {
-    UNOMUTEXGUARD aGuard( UNOMUTEX::getGlobalMutex() );
     UNOSEQUENCE< UNOOUSTRING > seqServiceNames( 3 );
     seqServiceNames.getArray() [0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ExtendedTypeDetection"  ));
     seqServiceNames.getArray() [1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.FormatDetector"  ));


More information about the Libreoffice-commits mailing list