diff options
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/macro_expander.cxx | 18 | ||||
-rw-r--r-- | cppuhelper/source/paths.cxx | 21 |
2 files changed, 9 insertions, 30 deletions
diff --git a/cppuhelper/source/macro_expander.cxx b/cppuhelper/source/macro_expander.cxx index 7d9b763aac05..a147d03a3e0d 100644 --- a/cppuhelper/source/macro_expander.cxx +++ b/cppuhelper/source/macro_expander.cxx @@ -51,23 +51,7 @@ namespace cppu static Bootstrap const & get_unorc() { - static rtlBootstrapHandle s_bstrap = nullptr; - if (! s_bstrap) - { - OUString iniName(getUnoIniUri()); - rtlBootstrapHandle bstrap = rtl_bootstrap_args_open( iniName.pData ); - - ClearableMutexGuard guard( Mutex::getGlobalMutex() ); - if (s_bstrap) - { - guard.clear(); - rtl_bootstrap_args_close( bstrap ); - } - else - { - s_bstrap = bstrap; - } - } + static rtlBootstrapHandle s_bstrap = rtl_bootstrap_args_open(getUnoIniUri().pData); return *reinterpret_cast<Bootstrap const *>(&s_bstrap); } diff --git a/cppuhelper/source/paths.cxx b/cppuhelper/source/paths.cxx index 6b7dcd443038..7ddd8b72d379 100644 --- a/cppuhelper/source/paths.cxx +++ b/cppuhelper/source/paths.cxx @@ -38,22 +38,17 @@ namespace { #ifndef ANDROID OUString get_this_libpath() { - static OUString s_uri; - if (s_uri.isEmpty()) { + static OUString s_uri = []() { OUString uri; - osl::Module::getUrlFromAddress( - reinterpret_cast< oslGenericFunction >(get_this_libpath), uri); + osl::Module::getUrlFromAddress(reinterpret_cast<oslGenericFunction>(get_this_libpath), uri); sal_Int32 i = uri.lastIndexOf('/'); - if (i == -1) { - throw css::uno::DeploymentException( - "URI " + uri + " is expected to contain a slash"); - } - uri = uri.copy(0, i); - osl::MutexGuard guard(osl::Mutex::getGlobalMutex()); - if (s_uri.isEmpty()) { - s_uri = uri; + if (i == -1) + { + throw css::uno::DeploymentException("URI " + uri + " is expected to contain a slash"); } - } + return uri.copy(0, i); + }(); + return s_uri; } #endif |