diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-11-18 20:41:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-19 09:00:01 +0100 |
commit | f3a0e8ba28d2a6e70d2ce9d4af1a9f823fec884f (patch) | |
tree | c2f513b65c2e95488dea9039b0255b05faba4c75 | |
parent | 8b1399cbb76b2f8b1722cb6a4a77b391f5af0862 (diff) |
rtl::Static->thread-safe static in xmloff
Change-Id: I5fa1f0a2b5336508841ef841bb56e2edb25e4ef7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125498
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | xmloff/inc/fasttokenhandler.hxx | 3 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLEnumConverter.cxx | 15 | ||||
-rw-r--r-- | xmloff/source/core/fasttokenhandler.cxx | 8 |
3 files changed, 12 insertions, 14 deletions
diff --git a/xmloff/inc/fasttokenhandler.hxx b/xmloff/inc/fasttokenhandler.hxx index 076cd90b55f4..f0acd0337563 100644 --- a/xmloff/inc/fasttokenhandler.hxx +++ b/xmloff/inc/fasttokenhandler.hxx @@ -14,7 +14,6 @@ #include <cppuhelper/implbase.hxx> #include <sax/fastattribs.hxx> #include <xmloff/token/tokens.hxx> -#include <rtl/instance.hxx> #include <sal/log.hxx> #include <xmloff/dllapi.h> @@ -66,7 +65,7 @@ private: static const OUString EMPTY_STRING; }; -struct StaticTokenMap : public rtl::Static< TokenMap, StaticTokenMap > {}; +TokenMap& StaticTokenMap(); class FastTokenHandler final : public sax_fastparser::FastTokenHandlerBase diff --git a/xmloff/source/chart/SchXMLEnumConverter.cxx b/xmloff/source/chart/SchXMLEnumConverter.cxx index 6349b457746c..7bb888ee0380 100644 --- a/xmloff/source/chart/SchXMLEnumConverter.cxx +++ b/xmloff/source/chart/SchXMLEnumConverter.cxx @@ -21,7 +21,6 @@ #include <com/sun/star/chart/ChartLegendExpansion.hpp> #include "SchXMLEnumConverter.hxx" #include <xmloff/xmlement.hxx> -#include <rtl/instance.hxx> using namespace ::xmloff::token; using namespace ::com::sun::star; @@ -45,10 +44,6 @@ public: : XMLEnumPropertyHdl( aXMLLegendPositionEnumMap) {} }; -struct TheLegendPositionPropertyHdl : public rtl::Static< XMLLegendPositionPropertyHdl, TheLegendPositionPropertyHdl > -{ -}; - const SvXMLEnumMapEntry<chart::ChartLegendExpansion> aXMLLegendExpansionEnumMap[] = { { XML_WIDE, chart::ChartLegendExpansion_WIDE }, @@ -65,19 +60,17 @@ public: : XMLEnumPropertyHdl( aXMLLegendExpansionEnumMap) {} }; -struct TheLegendExpansionPropertyHdl : public rtl::Static< XMLLegendExpansionPropertyHdl, TheLegendExpansionPropertyHdl > -{ -}; - }//end anonymous namespace XMLEnumPropertyHdl& SchXMLEnumConverter::getLegendPositionConverter() { - return TheLegendPositionPropertyHdl::get(); + static XMLLegendPositionPropertyHdl SINGLETON; + return SINGLETON; } XMLEnumPropertyHdl& SchXMLEnumConverter::getLegendExpansionConverter() { - return TheLegendExpansionPropertyHdl::get(); + static XMLLegendExpansionPropertyHdl SINGLETON; + return SINGLETON; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/core/fasttokenhandler.cxx b/xmloff/source/core/fasttokenhandler.cxx index 8d63cb74f8fc..9efdf8f15d5e 100644 --- a/xmloff/source/core/fasttokenhandler.cxx +++ b/xmloff/source/core/fasttokenhandler.cxx @@ -32,6 +32,12 @@ namespace token { using namespace css; +TokenMap& StaticTokenMap() +{ + static TokenMap SINGLETON; + return SINGLETON; +} + const css::uno::Sequence< sal_Int8 > TokenMap::EMPTY_BYTE_SEQ; const OUString TokenMap::EMPTY_STRING; @@ -68,7 +74,7 @@ sal_Int32 TokenMap::getTokenPerfectHash( const char *pStr, sal_Int32 nLength ) } FastTokenHandler::FastTokenHandler() : - mrTokenMap( StaticTokenMap::get() ) + mrTokenMap( StaticTokenMap() ) { } |