summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-11-04 15:28:37 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-11-04 14:46:01 +0100
commite128f7806961b391cfb265a1ce009b2e036622ca (patch)
treeeda1097987f07ac6e2f507f898b71ddf929e0635 /bridges
parenta2058e7516a01167c2d20ed157500b38db967c64 (diff)
replace double-checked locking patterns with thread safe local statics
Change-Id: I1bf67196e97411aeecc13ed4f91d1088a315e323 Reviewed-on: https://gerrit.libreoffice.org/62839 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'bridges')
-rw-r--r--bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_ios/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_intel/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_mips/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_mips64/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_s390/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_sparc64/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx13
-rw-r--r--bridges/source/cpp_uno/msvc_win32_intel/except.cxx20
-rw-r--r--bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx38
-rw-r--r--bridges/source/cpp_uno/shared/component.cxx40
22 files changed, 59 insertions, 286 deletions
diff --git a/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx b/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx
index bde3233e1491..e87590592888 100644
--- a/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx
@@ -225,17 +225,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
- static RTTI * s_rtti = 0;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ static RTTI rtti_data;
+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
if (! rtti)
terminate();
diff --git a/bridges/source/cpp_uno/gcc3_ios/except.cxx b/bridges/source/cpp_uno/gcc3_ios/except.cxx
index ae0348957312..2ef8ef49b966 100644
--- a/bridges/source/cpp_uno/gcc3_ios/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_ios/except.cxx
@@ -317,17 +317,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, nullptr );
// avoiding locked counts
- static RTTI * s_rtti = nullptr;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = s_rtti->getRTTI( reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr) );
+ static RTTI rtti_data;
+ rtti = rtti_data.getRTTI(reinterpret_cast<typelib_CompoundTypeDescription*>(pTypeDescr));
TYPELIB_DANGER_RELEASE( pTypeDescr );
assert(rtti && "### no rtti for throwing exception!");
if (! rtti)
diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx b/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx
index f0be82713583..9331665fab7f 100644
--- a/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx
@@ -223,17 +223,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
- static RTTI * s_rtti = 0;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ static RTTI rtti_data;
+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
if (! rtti)
terminate();
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx
index 3d5fe694e70d..9de606a8c6bf 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx
@@ -262,17 +262,8 @@ namespace CPPU_CURRENT_NAMESPACE
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
- static RTTI * s_rtti = 0;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ static RTTI rtti_data;
+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
assert(rtti && "### no rtti for throwing exception!");
if (! rtti)
diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx
index c3033fb49a2a..b5339eb2b1b6 100644
--- a/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx
@@ -236,17 +236,8 @@ namespace CPPU_CURRENT_NAMESPACE
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
- static RTTI * s_rtti = 0;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ static RTTI rtti_data;
+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
assert(rtti && "### no rtti for throwing exception!");
if (! rtti)
diff --git a/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx
index 9145071519ce..1241aa02e1eb 100644
--- a/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx
@@ -222,17 +222,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
- static RTTI * s_rtti = 0;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ static RTTI rtti_data;
+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
if (! rtti)
terminate();
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
index 108c5c843744..ad3350d50fc5 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
@@ -239,17 +239,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, nullptr );
// avoiding locked counts
- static RTTI * s_rtti = nullptr;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = s_rtti->getRTTI(reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr));
+ static RTTI rtti_data;
+ rtti = rtti_data.getRTTI(reinterpret_cast<typelib_CompoundTypeDescription*>(pTypeDescr));
TYPELIB_DANGER_RELEASE( pTypeDescr );
#if !defined(ANDROID) // see TODO above
assert(rtti && "### no rtti for throwing exception!");
diff --git a/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx b/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx
index cf2be0b0729d..047022f245c0 100644
--- a/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx
@@ -236,17 +236,8 @@ namespace CPPU_CURRENT_NAMESPACE
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
- static RTTI * s_rtti = 0;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ static RTTI rtti_data;
+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
assert(rtti && "### no rtti for throwing exception!");
if (! rtti)
diff --git a/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx b/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx
index a2d5cfb67c18..68e4e25f691d 100644
--- a/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx
@@ -233,17 +233,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
- static RTTI * s_rtti = 0;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ static RTTI rtti_data;
+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
assert(rtti && "### no rtti for throwing exception!");
if (! rtti)
diff --git a/bridges/source/cpp_uno/gcc3_linux_mips64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_mips64/except.cxx
index 8fc4d970bba7..ca94243d06fe 100644
--- a/bridges/source/cpp_uno/gcc3_linux_mips64/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_mips64/except.cxx
@@ -234,17 +234,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
- static RTTI * s_rtti = 0;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ static RTTI rtti_data;
+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
assert(rtti && "### no rtti for throwing exception!");
if (! rtti)
diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx
index 475c6f506b1d..ec26bc4969ee 100644
--- a/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx
@@ -224,17 +224,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
- static RTTI * s_rtti = 0;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ static RTTI rtti_data;
+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
if (! rtti)
terminate();
diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx
index 9145071519ce..1241aa02e1eb 100644
--- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx
@@ -222,17 +222,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
- static RTTI * s_rtti = 0;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ static RTTI rtti_data;
+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
if (! rtti)
terminate();
diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx
index f0be82713583..9331665fab7f 100644
--- a/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx
@@ -223,17 +223,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
- static RTTI * s_rtti = 0;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ static RTTI rtti_data;
+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
if (! rtti)
terminate();
diff --git a/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx b/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx
index 52c8e603a992..386069b9fb31 100644
--- a/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx
@@ -223,17 +223,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
- static RTTI * s_rtti = 0;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ static RTTI rtti_data;
+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
if (! rtti)
terminate();
diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx
index 2535da049848..a87eeac162db 100644
--- a/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx
@@ -234,17 +234,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
- static RTTI * s_rtti = 0;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ static RTTI rtti_data;
+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
assert(rtti);
if (! rtti)
diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc64/except.cxx
index 2535da049848..a87eeac162db 100644
--- a/bridges/source/cpp_uno/gcc3_linux_sparc64/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_sparc64/except.cxx
@@ -234,17 +234,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
- static RTTI * s_rtti = 0;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ static RTTI rtti_data;
+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
assert(rtti);
if (! rtti)
diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx
index 12058c53a2a2..2df4356c81b5 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx
@@ -317,17 +317,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, nullptr );
// avoiding locked counts
- static RTTI * s_rtti = nullptr;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = s_rtti->getRTTI( reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr) );
+ static RTTI rtti_data;
+ rtti = rtti_data.getRTTI(reinterpret_cast<typelib_CompoundTypeDescription*>(pTypeDescr));
TYPELIB_DANGER_RELEASE( pTypeDescr );
assert(rtti && "### no rtti for throwing exception!");
if (! rtti)
diff --git a/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx b/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx
index 263733677158..1eb183aa7c1f 100644
--- a/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx
@@ -236,17 +236,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
- static RTTI * s_rtti = 0;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ static RTTI rtti_data;
+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
assert(rtti);
if (! rtti)
diff --git a/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx b/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx
index 6545e4820f11..752b03e619f5 100644
--- a/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx
@@ -233,17 +233,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
- static RTTI * s_rtti = 0;
- if (! s_rtti)
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if (! s_rtti)
- {
- static RTTI rtti_data;
- s_rtti = &rtti_data;
- }
- }
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ static RTTI rtti_data;
+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
assert(rtti && "### no rtti for throwing exception!");
if (! rtti)
diff --git a/bridges/source/cpp_uno/msvc_win32_intel/except.cxx b/bridges/source/cpp_uno/msvc_win32_intel/except.cxx
index 8e6a1795f898..805eae40e5de 100644
--- a/bridges/source/cpp_uno/msvc_win32_intel/except.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_intel/except.cxx
@@ -384,15 +384,7 @@ ExceptionInfos::~ExceptionInfos() throw ()
void * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTypeDescr ) throw ()
{
- static ExceptionInfos * s_pInfos = 0;
- if (! s_pInfos)
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (! s_pInfos)
- {
- s_pInfos = new ExceptionInfos();
- }
- }
+ static ExceptionInfos* s_pInfos = new ExceptionInfos();
assert( pTypeDescr &&
(pTypeDescr->eTypeClass == typelib_TypeClass_STRUCT ||
@@ -427,15 +419,7 @@ void * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTypeDescr ) thro
type_info * msci_getRTTI( OUString const & rUNOname )
{
- static RTTInfos * s_pRTTIs = 0;
- if (! s_pRTTIs)
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (! s_pRTTIs)
- {
- s_pRTTIs = new RTTInfos();
- }
- }
+ static RTTInfos* s_pRTTIs = new RTTInfos();
return s_pRTTIs->getRTTI( rUNOname );
}
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx
index 27879b066a59..090ec5c13e38 100644
--- a/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx
@@ -681,19 +681,13 @@ ExceptionInfos::ExceptionInfos() throw ()
RaiseInfo * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTD ) throw ()
{
- static ExceptionInfos * s_pInfos = nullptr;
- if (! s_pInfos)
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (! s_pInfos)
- {
- SYSTEM_INFO systemInfo;
- GetSystemInfo( &systemInfo );
- allocationGranularity = systemInfo.dwAllocationGranularity;
+ static ExceptionInfos* s_pInfos = []() {
+ SYSTEM_INFO systemInfo;
+ GetSystemInfo(&systemInfo);
+ allocationGranularity = systemInfo.dwAllocationGranularity;
- s_pInfos = new ExceptionInfos();
- }
- }
+ return new ExceptionInfos();
+ }();
assert( pTD &&
(pTD->eTypeClass == typelib_TypeClass_STRUCT ||
@@ -726,29 +720,13 @@ RaiseInfo * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTD ) throw
type_info * mscx_getRTTI(
OUString const & rUNOname )
{
- static RTTInfos * s_pRTTIs = nullptr;
- if (! s_pRTTIs)
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (! s_pRTTIs)
- {
- s_pRTTIs = new RTTInfos();
- }
- }
+ static RTTInfos* s_pRTTIs = new RTTInfos();
return s_pRTTIs->getRTTI( rUNOname );
}
int mscx_getRTTI_len(
OUString const & rUNOname)
{
- static RTTInfos * s_pRTTIs = nullptr;
- if (!s_pRTTIs)
- {
- MutexGuard aGuard(Mutex::getGlobalMutex());
- if (!s_pRTTIs)
- {
- s_pRTTIs = new RTTInfos();
- }
- }
+ static RTTInfos* s_pRTTIs = new RTTInfos();
return s_pRTTIs->getRTTI_len(rUNOname);
}
diff --git a/bridges/source/cpp_uno/shared/component.cxx b/bridges/source/cpp_uno/shared/component.cxx
index 7b380a425792..b8f4d7f6511e 100644
--- a/bridges/source/cpp_uno/shared/component.cxx
+++ b/bridges/source/cpp_uno/shared/component.cxx
@@ -38,39 +38,21 @@
namespace {
-#if (defined(__GNUC__) && defined(__APPLE__))
-static OUString * s_pStaticOidPart = nullptr;
-#endif
-
const OUString & cppu_cppenv_getStaticOIdPart()
{
-#if ! (defined(__GNUC__) && defined(__APPLE__))
- static OUString * s_pStaticOidPart = nullptr;
-#endif
- if (! s_pStaticOidPart)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! s_pStaticOidPart)
+ static OUString s_aStaticOidPart = []() {
+ OUStringBuffer aRet(64);
+ aRet.append("];");
+ // good guid
+ sal_uInt8 ar[16];
+ ::rtl_getGlobalProcessId(ar);
+ for (unsigned char i : ar)
{
- OUStringBuffer aRet( 64 );
- aRet.append( "];" );
- // good guid
- sal_uInt8 ar[16];
- ::rtl_getGlobalProcessId( ar );
- for (unsigned char i : ar)
- {
- aRet.append( static_cast<sal_Int32>(i), 16 );
- }
-#if (defined(__GNUC__) && defined(__APPLE__))
- s_pStaticOidPart = new OUString( aRet.makeStringAndClear() );
-#else
- static OUString s_aStaticOidPart(
- aRet.makeStringAndClear() );
- s_pStaticOidPart = &s_aStaticOidPart;
-#endif
+ aRet.append(static_cast<sal_Int32>(i), 16);
}
- }
- return *s_pStaticOidPart;
+ return aRet.makeStringAndClear();
+ }();
+ return s_aStaticOidPart;
}
}