diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2017-06-17 12:00:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-17 13:28:18 +0200 |
commit | d69795b9c9d2dac7b751c6fe8b4663c0c26a129b (patch) | |
tree | e900e25a1055aa46c3b54a63bb256a82cba370c6 /ucb | |
parent | 76ed00f8db34490d5e21c72d142e11da510ac605 (diff) |
use local statics in getTypes functions
... instead of double checked locking patterns.
Change-Id: I1b86ce723ff22dd357b3ed69a52757b085472424
Reviewed-on: https://gerrit.libreoffice.org/38906
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/cacher/cachedcontentresultsetstub.cxx | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/ucb/source/cacher/cachedcontentresultsetstub.cxx b/ucb/source/cacher/cachedcontentresultsetstub.cxx index 49d81c49bc37..c6ed4018072b 100644 --- a/ucb/source/cacher/cachedcontentresultsetstub.cxx +++ b/ucb/source/cacher/cachedcontentresultsetstub.cxx @@ -137,29 +137,22 @@ XTYPEPROVIDER_COMMON_IMPL( CachedContentResultSetStub ) Sequence< Type > SAL_CALL CachedContentResultSetStub ::getTypes() { - static Sequence< Type >* pTypes = nullptr; - if( !pTypes ) - { - osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); - if( !pTypes ) - { - pTypes = new Sequence< Type >(13); - (*pTypes)[0] = CPPU_TYPE_REF( XTypeProvider ); - (*pTypes)[1] = CPPU_TYPE_REF( XServiceInfo ); - (*pTypes)[2] = CPPU_TYPE_REF( XComponent ); - (*pTypes)[3] = CPPU_TYPE_REF( XCloseable ); - (*pTypes)[4] = CPPU_TYPE_REF( XResultSetMetaDataSupplier ); - (*pTypes)[5] = CPPU_TYPE_REF( XPropertySet ); - (*pTypes)[6] = CPPU_TYPE_REF( XPropertyChangeListener ); - (*pTypes)[7] = CPPU_TYPE_REF( XVetoableChangeListener ); - (*pTypes)[8] = CPPU_TYPE_REF( XResultSet ); - (*pTypes)[9] = CPPU_TYPE_REF( XContentAccess ); - (*pTypes)[10] = CPPU_TYPE_REF( XRow ); - (*pTypes)[11] = CPPU_TYPE_REF( XFetchProvider ); - (*pTypes)[12] = CPPU_TYPE_REF( XFetchProviderForContentAccess ); - } - } - return *pTypes; + static Sequence<Type> ourTypes( + { CPPU_TYPE_REF( XTypeProvider ), + CPPU_TYPE_REF( XServiceInfo ), + CPPU_TYPE_REF( XComponent ), + CPPU_TYPE_REF( XCloseable ), + CPPU_TYPE_REF( XResultSetMetaDataSupplier ), + CPPU_TYPE_REF( XPropertySet ), + CPPU_TYPE_REF( XPropertyChangeListener ), + CPPU_TYPE_REF( XVetoableChangeListener ), + CPPU_TYPE_REF( XResultSet ), + CPPU_TYPE_REF( XContentAccess ), + CPPU_TYPE_REF( XRow ), + CPPU_TYPE_REF( XFetchProvider ), + CPPU_TYPE_REF( XFetchProviderForContentAccess ) } ); + + return ourTypes; } |