summaryrefslogtreecommitdiff
path: root/linguistic
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-09-10 19:25:04 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-09-12 10:13:54 +0200
commit7458cb8d13b2893ccbfb648198319cc3a73d7e50 (patch)
tree6128746a4e8a50b4841140b253ef2d110d15d27a /linguistic
parentf169e732d0b89a9bbbcf1afd19d20d25343e0b2e (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.cxx9
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 )