diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-09-10 19:25:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-12 10:13:54 +0200 |
commit | 7458cb8d13b2893ccbfb648198319cc3a73d7e50 (patch) | |
tree | 6128746a4e8a50b4841140b253ef2d110d15d27a /linguistic | |
parent | f169e732d0b89a9bbbcf1afd19d20d25343e0b2e (diff) |
no need to allocate this on the heap
Change-Id: I33a85dfd8108c2131aa6d2a9b94d0b2c3d86bce8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139782
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'linguistic')
-rw-r--r-- | linguistic/source/misc.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index de2bc96860ee..dc4c17ce8430 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -18,6 +18,7 @@ */ #include <memory> +#include <optional> #include <sal/log.hxx> #include <svl/lngmisc.hxx> #include <ucbhelper/content.hxx> @@ -64,10 +65,10 @@ osl::Mutex & GetLinguMutex() const LocaleDataWrapper & GetLocaleDataWrapper( LanguageType nLang ) { - static std::unique_ptr<LocaleDataWrapper> xLclDtaWrp; - if (!xLclDtaWrp || xLclDtaWrp->getLoadedLanguageTag().getLanguageType() != nLang) - xLclDtaWrp.reset(new LocaleDataWrapper(LanguageTag( nLang ))); - return *xLclDtaWrp; + static std::optional<LocaleDataWrapper> oLclDtaWrp; + if (!oLclDtaWrp || oLclDtaWrp->getLoadedLanguageTag().getLanguageType() != nLang) + oLclDtaWrp.emplace(LanguageTag( nLang )); + return *oLclDtaWrp; } LanguageType LinguLocaleToLanguage( const css::lang::Locale& rLocale ) |