Kaydet (Commit) 6b7043e2 authored tarafından Caolán McNamara's avatar Caolán McNamara

use rtl::Static where double-locked pattern used

üst 58c5f8a4
......@@ -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()
......
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment