diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-22 08:56:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-22 12:46:56 +0100 |
commit | 06ad764cfb36ece7f054ecb786cc0395346a6a68 (patch) | |
tree | f67c2045e736fbbdb67d18255380b2d9288d75e4 /svtools/source | |
parent | a73494cf130866d4e678a1f421df56cdba7441d8 (diff) |
improve function-local statics in scripting..svtools
Change-Id: Idf3785a1fbc6fc5b8efbdc4cd363047709f3af91
Reviewed-on: https://gerrit.libreoffice.org/63782
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools/source')
-rw-r--r-- | svtools/source/config/apearcfg.cxx | 15 | ||||
-rw-r--r-- | svtools/source/config/htmlcfg.cxx | 13 |
2 files changed, 4 insertions, 24 deletions
diff --git a/svtools/source/config/apearcfg.cxx b/svtools/source/config/apearcfg.cxx index b98a8cbad17e..4bfe5595012c 100644 --- a/svtools/source/config/apearcfg.cxx +++ b/svtools/source/config/apearcfg.cxx @@ -94,11 +94,8 @@ SvtTabAppearanceCfg::~SvtTabAppearanceCfg( ) const Sequence<OUString>& SvtTabAppearanceCfg::GetPropertyNames() { - static Sequence<OUString> aNames; - if(!aNames.getLength()) + static Sequence<OUString> const aNames { - static const sal_Char* aPropNames[] = - { "Window/Drag" // 0 ,"Menu/FollowMouse" // 1 ,"Dialog/MousePositioning" // 2 @@ -107,15 +104,7 @@ const Sequence<OUString>& SvtTabAppearanceCfg::GetPropertyNames() ,"FontAntiAliasing/Enabled" // 4 ,"FontAntiAliasing/MinPixelHeight" // 5 #endif - }; - const int nCount = SAL_N_ELEMENTS( aPropNames ); - aNames.realloc(nCount); - - const sal_Char** pAsciiNames = aPropNames; - OUString* pNames = aNames.getArray(); - for(int i = 0; i < nCount; ++i, ++pNames, ++pAsciiNames) - *pNames = OUString::createFromAscii( *pAsciiNames ); - } + }; return aNames; } diff --git a/svtools/source/config/htmlcfg.cxx b/svtools/source/config/htmlcfg.cxx index 5fd83ff7027d..7c78ebee4201 100644 --- a/svtools/source/config/htmlcfg.cxx +++ b/svtools/source/config/htmlcfg.cxx @@ -76,11 +76,8 @@ struct HtmlOptions_Impl const Sequence<OUString>& SvxHtmlOptions::GetPropertyNames() { - static Sequence<OUString> aNames; - if(!aNames.getLength()) + static Sequence<OUString> const aNames { - static const char* aPropNames[] = - { "Import/UnknownTag", // 0 "Import/FontSetting", // 1 "Import/FontSize/Size_1", // 2 @@ -97,13 +94,7 @@ const Sequence<OUString>& SvxHtmlOptions::GetPropertyNames() "Export/Warning", // 13 "Export/Encoding", // 14 "Import/NumbersEnglishUS" // 15 - }; - const int nCount = SAL_N_ELEMENTS(aPropNames); - aNames.realloc(nCount); - OUString* pNames = aNames.getArray(); - for(int i = 0; i < nCount; i++) - pNames[i] = OUString::createFromAscii(aPropNames[i]); - } + }; return aNames; } |