diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-30 20:54:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-31 08:55:29 +0200 |
commit | a943936eeff04b60ebd0b2552bc18b42606f3321 (patch) | |
tree | e3a20ebf81feaa0914e9e5b9a0fe008e0ea61c2e /sal | |
parent | 620f9649ae55e01700419876ce25ab4e45ed859f (diff) |
rtl::Static -> static local
in a handful cases, like a map or a vector, we don't need init on demand
at all, the default constructor can be laid out at compile time
Change-Id: Ifa3188af7a65cd475ce0f603d15a8c26bcda7e6d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119710
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/rtl/bootstrap.cxx | 10 | ||||
-rw-r--r-- | sal/rtl/rtl_process.cxx | 6 | ||||
-rw-r--r-- | sal/textenc/textenc.cxx | 10 |
3 files changed, 10 insertions, 16 deletions
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx index afb80dcd66cb..52ee7f38d24d 100644 --- a/sal/rtl/bootstrap.cxx +++ b/sal/rtl/bootstrap.cxx @@ -146,8 +146,7 @@ static bool find( namespace { - struct rtl_bootstrap_set_vector : - public rtl::Static< NameValueVector, rtl_bootstrap_set_vector > {}; + NameValueVector rtl_bootstrap_set_vector; } static bool getFromCommandLineArgs( @@ -551,7 +550,7 @@ bool Bootstrap_Impl::getAmbienceValue( { osl::MutexGuard g(osl::Mutex::getGlobalMutex()); - f = find(rtl_bootstrap_set_vector::get(), key, &v); + f = find(rtl_bootstrap_set_vector, key, &v); } if (f || getFromCommandLineArgs(key, &v) || @@ -744,8 +743,7 @@ void SAL_CALL rtl_bootstrap_set ( osl::MutexGuard guard(osl::Mutex::getGlobalMutex()); - NameValueVector& r_rtl_bootstrap_set_vector= rtl_bootstrap_set_vector::get(); - for (auto & item : r_rtl_bootstrap_set_vector) + for (auto & item : rtl_bootstrap_set_vector) { if (item.sName == name) { @@ -756,7 +754,7 @@ void SAL_CALL rtl_bootstrap_set ( SAL_INFO("sal.bootstrap", "explicitly getting: name=" << name << " value=" <<value); - r_rtl_bootstrap_set_vector.emplace_back(name, value); + rtl_bootstrap_set_vector.emplace_back(name, value); } void SAL_CALL rtl_bootstrap_expandMacros_from_handle( diff --git a/sal/rtl/rtl_process.cxx b/sal/rtl/rtl_process.cxx index 42c24e80074d..76963dc1376b 100644 --- a/sal/rtl/rtl_process.cxx +++ b/sal/rtl/rtl_process.cxx @@ -21,7 +21,6 @@ #include <cstring> -#include <rtl/instance.hxx> #include <rtl/process.h> #include <rtl/uuid.h> #include <sal/types.h> @@ -46,13 +45,12 @@ private: sal_uInt8 uuid_[UUID_SIZE]; }; -struct theId: public rtl::Static< Id, theId > {}; - } // end namespace void rtl_getGlobalProcessId(sal_uInt8 * pTargetUUID) { - theId::get().copy(pTargetUUID); + static Id theId; + theId.copy(pTargetUUID); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/textenc/textenc.cxx b/sal/textenc/textenc.cxx index b0856f9add1c..1d7279f849a4 100644 --- a/sal/textenc/textenc.cxx +++ b/sal/textenc/textenc.cxx @@ -27,7 +27,6 @@ #include <cstdlib> #include <osl/module.hxx> -#include <rtl/instance.hxx> #include <rtl/textenc.h> #include <rtl/ustring.h> #include <rtl/ustring.hxx> @@ -409,10 +408,6 @@ private: #endif -struct FullTextEncodingDataSingleton: - public rtl::Static< FullTextEncodingData, FullTextEncodingDataSingleton > -{}; - } ImplTextEncodingData const * @@ -431,7 +426,10 @@ Impl_getTextEncodingData(rtl_TextEncoding nEncoding) case RTL_TEXTENCODING_ISO_8859_1: return &aImplISO88591TextEncodingData; break; default: - return FullTextEncodingDataSingleton::get().get(nEncoding); + { + static FullTextEncodingData gFullTextEncodingData; + return gFullTextEncodingData.get(nEncoding); + } } } |