summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-07-29 11:22:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-29 14:35:44 +0200
commit6c7d6924511f3006f64fb9d3eadd289778098571 (patch)
tree297a3f410e9b3281a1799b18c98441a837b8a560 /unotools
parent2e894d5053dccadc41f4c449e8fbdd3ada0c5bdc (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: I2d404584b5aa23db7b1f779e160e04e72dd2aa74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119656 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/config/useroptions.cxx9
-rw-r--r--unotools/source/i18n/localedatawrapper.cxx20
-rw-r--r--unotools/source/ucbhelper/tempfile.cxx7
3 files changed, 10 insertions, 26 deletions
diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx
index bf877b790392..ffe01cca497c 100644
--- a/unotools/source/config/useroptions.cxx
+++ b/unotools/source/config/useroptions.cxx
@@ -23,7 +23,6 @@
#include <unotools/syslocale.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <osl/mutex.hxx>
-#include <rtl/instance.hxx>
#include "itemholder1.hxx"
#include <cppuhelper/implbase.hxx>
@@ -282,14 +281,10 @@ SvtUserOptions::~SvtUserOptions()
xImpl->RemoveListener(this);
}
-namespace
-{
- class theUserOptionsMutex : public rtl::Static<osl::Mutex, theUserOptionsMutex>{};
-}
-
osl::Mutex& SvtUserOptions::GetInitMutex()
{
- return theUserOptionsMutex::get();
+ static osl::Mutex gMutex;
+ return gMutex;
}
OUString SvtUserOptions::GetCompany () const { return GetToken(UserOptToken::Company); }
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index fb70c0657a73..b6a286a07fc2 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -38,7 +38,6 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
-#include <rtl/instance.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/math.hxx>
@@ -50,15 +49,8 @@ using namespace ::com::sun::star::uno;
namespace
{
- struct InstalledLocales
- : public rtl::Static<
- uno::Sequence< lang::Locale >, InstalledLocales >
- {};
-
- struct InstalledLanguageTypes
- : public rtl::Static<
- std::vector< LanguageType >, InstalledLanguageTypes >
- {};
+ uno::Sequence< lang::Locale > gInstalledLocales;
+ std::vector< LanguageType > gInstalledLanguageTypes;
}
sal_uInt8 LocaleDataWrapper::nLocaleDataChecking = 0;
@@ -279,7 +271,7 @@ css::i18n::ForbiddenCharacters LocaleDataWrapper::getForbiddenCharacters() const
css::uno::Sequence< css::lang::Locale > LocaleDataWrapper::getAllInstalledLocaleNames() const
{
- uno::Sequence< lang::Locale > &rInstalledLocales = InstalledLocales::get();
+ uno::Sequence< lang::Locale > &rInstalledLocales = gInstalledLocales;
if ( rInstalledLocales.hasElements() )
return rInstalledLocales;
@@ -300,8 +292,7 @@ css::uno::Sequence< css::lang::Locale > LocaleDataWrapper::getAllInstalledLocale
// static
css::uno::Sequence< css::lang::Locale > LocaleDataWrapper::getInstalledLocaleNames()
{
- const uno::Sequence< lang::Locale > &rInstalledLocales =
- InstalledLocales::get();
+ const uno::Sequence< lang::Locale > &rInstalledLocales = gInstalledLocales;
if ( !rInstalledLocales.hasElements() )
{
@@ -314,8 +305,7 @@ css::uno::Sequence< css::lang::Locale > LocaleDataWrapper::getInstalledLocaleNam
// static
std::vector< LanguageType > LocaleDataWrapper::getInstalledLanguageTypes()
{
- std::vector< LanguageType > &rInstalledLanguageTypes =
- InstalledLanguageTypes::get();
+ std::vector< LanguageType > &rInstalledLanguageTypes = gInstalledLanguageTypes;
if ( !rInstalledLanguageTypes.empty() )
return rInstalledLanguageTypes;
diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx
index 25c15920d52b..bf41c00e2428 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -41,8 +41,7 @@ using namespace osl;
namespace
{
- struct TempNameBase_Impl
- : public rtl::Static< OUString, TempNameBase_Impl > {};
+ OUString gTempNameBase_Impl;
}
namespace utl
@@ -143,7 +142,7 @@ static OUString ConstructTempDir_Impl( const OUString* pParent, bool bCreatePare
if ( aName.isEmpty() )
{
- OUString &rTempNameBase_Impl = TempNameBase_Impl::get();
+ OUString &rTempNameBase_Impl = gTempNameBase_Impl;
if (rTempNameBase_Impl.isEmpty())
{
OUString ustrTempDirURL;
@@ -463,7 +462,7 @@ OUString TempFile::SetTempNameBaseDirectory( const OUString &rBaseName )
if ( bRet )
{
// append own internal directory
- OUString &rTempNameBase_Impl = TempNameBase_Impl::get();
+ OUString &rTempNameBase_Impl = gTempNameBase_Impl;
rTempNameBase_Impl = rBaseName + "/";
TempFile aBase( nullptr, true );