diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-05-31 13:03:18 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-06-01 15:35:10 +0100 |
commit | 9aad6692612fca11230fdcbcaef436d2d1e1c0b4 (patch) | |
tree | 999de0aa5131bc713b0b102a930ab6395e2426d3 /io | |
parent | 1c33dd6d012f8e3011f5b9df396f004acbc102d0 (diff) |
this is overly static + double check lock for little gain
Diffstat (limited to 'io')
-rw-r--r-- | io/source/TextInputStream/TextInputStream.cxx | 15 | ||||
-rw-r--r-- | io/source/TextOutputStream/TextOutputStream.cxx | 15 | ||||
-rw-r--r-- | io/source/acceptor/acceptor.cxx | 15 | ||||
-rw-r--r-- | io/source/connector/connector.cxx | 15 |
4 files changed, 12 insertions, 48 deletions
diff --git a/io/source/TextInputStream/TextInputStream.cxx b/io/source/TextInputStream/TextInputStream.cxx index f4f117d718f7..9b2cbfeda57b 100644 --- a/io/source/TextInputStream/TextInputStream.cxx +++ b/io/source/TextInputStream/TextInputStream.cxx @@ -458,18 +458,9 @@ OUString TextInputStream_getImplementationName() Sequence< OUString > TextInputStream_getSupportedServiceNames() { - static Sequence < OUString > *pNames = 0; - if( ! pNames ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( !pNames ) - { - static Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ) ); - pNames = &seqNames; - } - } - return *pNames; + Sequence< OUString > seqNames(1); + seqNames.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ) ); + return seqNames; } OUString OTextInputStream::getImplementationName() throw() diff --git a/io/source/TextOutputStream/TextOutputStream.cxx b/io/source/TextOutputStream/TextOutputStream.cxx index b7a3cd384e1d..1f54a64d0633 100644 --- a/io/source/TextOutputStream/TextOutputStream.cxx +++ b/io/source/TextOutputStream/TextOutputStream.cxx @@ -255,18 +255,9 @@ OUString TextOutputStream_getImplementationName() SAL_THROW( () ) Sequence< OUString > TextOutputStream_getSupportedServiceNames() { - static Sequence < OUString > *pNames = 0; - if( ! pNames ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( !pNames ) - { - static Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ) ); - pNames = &seqNames; - } - } - return *pNames; + Sequence< OUString > seqNames(1); + seqNames.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ) ); + return seqNames; } OUString OTextOutputStream::getImplementationName() throw() diff --git a/io/source/acceptor/acceptor.cxx b/io/source/acceptor/acceptor.cxx index ea3cb02d11dc..f68ffe07d634 100644 --- a/io/source/acceptor/acceptor.cxx +++ b/io/source/acceptor/acceptor.cxx @@ -301,18 +301,9 @@ namespace io_acceptor Sequence< OUString > acceptor_getSupportedServiceNames() { - static Sequence < OUString > *pNames = 0; - if( ! pNames ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( !pNames ) - { - static Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICE_NAME)); - pNames = &seqNames; - } - } - return *pNames; + Sequence< OUString > seqNames(1); + seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICE_NAME)); + return seqNames; } OUString OAcceptor::getImplementationName() throw() diff --git a/io/source/connector/connector.cxx b/io/source/connector/connector.cxx index 92a8fdb86641..192b97075fad 100644 --- a/io/source/connector/connector.cxx +++ b/io/source/connector/connector.cxx @@ -204,18 +204,9 @@ namespace stoc_connector Sequence< OUString > connector_getSupportedServiceNames() { - static Sequence < OUString > *pNames = 0; - if( ! pNames ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( !pNames ) - { - static Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICE_NAME)); - pNames = &seqNames; - } - } - return *pNames; + Sequence< OUString > seqNames(1); + seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICE_NAME)); + return seqNames; } OUString connector_getImplementationName() |