diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-21 11:47:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-22 07:33:56 +0100 |
commit | 2e6a38b7f007b36719f5fc002cb4363dec45e0d4 (patch) | |
tree | 7b9c691228821149d96d3859be07f50bc1e93515 /extensions | |
parent | ca037ca06e5b261a243af15aa57d2b8ee047806e (diff) |
improve function-local statics in dbaccess..filter
Change-Id: I64939ad4b6c53696e33300114db384abfe73f13f
Reviewed-on: https://gerrit.libreoffice.org/63702
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/bibliography/bibconfig.cxx | 23 | ||||
-rw-r--r-- | extensions/source/dbpilots/dbpservices.cxx | 9 | ||||
-rw-r--r-- | extensions/source/propctrlr/pcrservices.cxx | 9 |
3 files changed, 20 insertions, 21 deletions
diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx index aa340c391c8f..710b7696c1d1 100644 --- a/extensions/source/bibliography/bibconfig.cxx +++ b/extensions/source/bibliography/bibconfig.cxx @@ -40,20 +40,17 @@ const char cDataSourceHistory[] = "DataSourceHistory"; Sequence<OUString> const & BibConfig::GetPropertyNames() { - static Sequence<OUString> aNames; - if(!aNames.getLength()) + static Sequence<OUString> aNames = { - aNames.realloc(8); - OUString* pNames = aNames.getArray(); - pNames[0] = "CurrentDataSource/DataSourceName"; - pNames[1] = "CurrentDataSource/Command"; - pNames[2] = "CurrentDataSource/CommandType"; - pNames[3] = "BeamerHeight"; - pNames[4] = "ViewHeight"; - pNames[5] = "QueryText"; - pNames[6] = "QueryField"; - pNames[7] = "ShowColumnAssignmentWarning"; - } + "CurrentDataSource/DataSourceName", + "CurrentDataSource/Command", + "CurrentDataSource/CommandType", + "BeamerHeight", + "ViewHeight", + "QueryText", + "QueryField", + "ShowColumnAssignmentWarning" + }; return aNames; } diff --git a/extensions/source/dbpilots/dbpservices.cxx b/extensions/source/dbpilots/dbpservices.cxx index 054924b5aa04..42779c6d1754 100644 --- a/extensions/source/dbpilots/dbpservices.cxx +++ b/extensions/source/dbpilots/dbpservices.cxx @@ -19,6 +19,7 @@ #include <componentmodule.hxx> #include "dbpservices.hxx" +#include <mutex> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -28,14 +29,14 @@ extern "C" { static void dbp_initializeModule() { - static bool s_bInit = false; - if (!s_bInit) + std::once_flag aInit; + std::call_once(aInit, [&]() { createRegistryInfo_OGroupBoxWizard(); createRegistryInfo_OListComboWizard(); createRegistryInfo_OGridWizard(); - s_bInit = true; - } + return true; + }); } } diff --git a/extensions/source/propctrlr/pcrservices.cxx b/extensions/source/propctrlr/pcrservices.cxx index eb4368bb7da4..8156ffeb603a 100644 --- a/extensions/source/propctrlr/pcrservices.cxx +++ b/extensions/source/propctrlr/pcrservices.cxx @@ -20,6 +20,7 @@ #include "modulepcr.hxx" #include "pcrservices.hxx" +#include <mutex> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -29,8 +30,8 @@ extern "C" { static void pcr_initializeModule() { - static bool s_bInit = false; - if (!s_bInit) + std::once_flag aInit; + std::call_once(aInit, [&]() { createRegistryInfo_OPropertyBrowserController(); createRegistryInfo_FormController(); @@ -51,8 +52,8 @@ static void pcr_initializeModule() createRegistryInfo_StringRepresentation(); createRegistryInfo_MasterDetailLinkDialog(); createRegistryInfo_FormGeometryHandler(); - s_bInit = true; - } + return true; + }); } } |