Kaydet (Commit) 44d24455 authored tarafından Caolán McNamara's avatar Caolán McNamara

use rtl::Static where double-locked pattern used

üst c0e0ae54
...@@ -825,14 +825,14 @@ extern "C" void SAL_CALL uno_dumpEnvironmentByName( ...@@ -825,14 +825,14 @@ extern "C" void SAL_CALL uno_dumpEnvironmentByName(
} }
} }
//------------------------------------------------------------------------------ namespace
inline static const OUString & unoenv_getStaticOIdPart()
{ {
static OUString * s_pStaticOidPart = 0; class makeOIdPart
if (! s_pStaticOidPart)
{ {
::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() ); private:
if (! s_pStaticOidPart) OUString m_sOidPart;
public:
makeOIdPart()
{ {
::rtl::OUStringBuffer aRet( 64 ); ::rtl::OUStringBuffer aRet( 64 );
aRet.appendAscii( RTL_CONSTASCII_STRINGPARAM("];") ); aRet.appendAscii( RTL_CONSTASCII_STRINGPARAM("];") );
...@@ -856,11 +856,18 @@ inline static const OUString & unoenv_getStaticOIdPart() ...@@ -856,11 +856,18 @@ inline static const OUString & unoenv_getStaticOIdPart()
for ( sal_Int32 i = 0; i < 16; ++i ) for ( sal_Int32 i = 0; i < 16; ++i )
aRet.append( (sal_Int32)ar[i], 16 ); aRet.append( (sal_Int32)ar[i], 16 );
static OUString s_aStaticOidPart( aRet.makeStringAndClear() ); m_sOidPart = aRet.makeStringAndClear();
s_pStaticOidPart = &s_aStaticOidPart;
} }
} const OUString& getOIdPart() const { return m_sOidPart; }
return *s_pStaticOidPart; };
class theStaticOIdPart : public rtl::Static<makeOIdPart, theStaticOIdPart> {};
}
//------------------------------------------------------------------------------
inline static const OUString & unoenv_getStaticOIdPart()
{
return theStaticOIdPart::get().getOIdPart();
} }
extern "C" extern "C"
......
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