diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-20 13:09:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-23 13:35:25 +0100 |
commit | 70894bcdb3912dbe87031da0af9ae5d591275e2a (patch) | |
tree | ca424232691a12bfca34293b093a7d9bd21525e9 /unotools | |
parent | 0c8b936734285ee7f373c41ecbad5a65953789dc (diff) |
improve function local statics
simplify the initialisaion and make them thread-safe i.e. initialise
them using the runtime's local static locking.
Thanks to mike kaganski for pointing out the nice lambda approach that
makes this feasible.
Change-Id: I76391189a6d0a3d7eed2d0d88d28dfa6541eaff7
Reviewed-on: https://gerrit.libreoffice.org/63645
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/fltrcfg.cxx | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/unotools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx index 32a61fdae8a1..89b8374a761d 100644 --- a/unotools/source/config/fltrcfg.cxx +++ b/unotools/source/config/fltrcfg.cxx @@ -303,13 +303,8 @@ namespace { const Sequence<OUString>& GetPropertyNames() { - static Sequence<OUString> aNames; - if(!aNames.getLength()) + static Sequence<OUString> const aNames { - int nCount = 14; - aNames.realloc(nCount); - static const char* aPropNames[] = - { "Import/MathTypeToMath", // 0 "Import/WinWordToWriter", // 1 "Import/PowerPointToImpress", // 2 @@ -324,11 +319,7 @@ const Sequence<OUString>& GetPropertyNames() "Import/ImportWWFieldsAsEnhancedFields", // 11 "Import/SmartArtToShapes", // 12 "Export/CharBackgroundToHighlighting" // 13 - }; - OUString* pNames = aNames.getArray(); - for(int i = 0; i < nCount; i++) - pNames[i] = OUString::createFromAscii(aPropNames[i]); - } + }; return aNames; } |