From a943936eeff04b60ebd0b2552bc18b42606f3321 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 30 Jul 2021 20:54:50 +0200 Subject: 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 --- sal/rtl/bootstrap.cxx | 10 ++++------ sal/rtl/rtl_process.cxx | 6 ++---- sal/textenc/textenc.cxx | 10 ++++------ 3 files changed, 10 insertions(+), 16 deletions(-) (limited to 'sal') 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=" < -#include #include #include #include @@ -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 #include -#include #include #include #include @@ -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); + } } } -- cgit