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 | 0c63f147223cd74f30ec8f830575b3c3e64460ca (patch) | |
tree | d8a6c216b9a5643ee34eef955050853038d49ebb | |
parent | ac0e691bb0cead4f4c9d5b402803391729170b1a (diff) |
this is overly static + double check lock for little gain
-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 1f3c3580f..229731da6 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 56ede0b61..79a06d750 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 e4ef83da3..65770dfab 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 5fdb26a4b..67eea93f0 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() |