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 /scripting | |
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 'scripting')
-rw-r--r-- | scripting/source/vbaevents/eventhelper.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx index 86d941df9e74..408539cb7038 100644 --- a/scripting/source/vbaevents/eventhelper.cxx +++ b/scripting/source/vbaevents/eventhelper.cxx @@ -256,10 +256,9 @@ static TranslatePropMap aTranslatePropMap_Impl[] = static EventInfoHash& getEventTransInfo() { - static bool initialised = false; - static EventInfoHash eventTransInfo; - if ( !initialised ) + static EventInfoHash eventTransInfo = [&]() { + EventInfoHash tmp; OUString sEventInfo; TranslatePropMap* pTransProp = aTranslatePropMap_Impl; int nCount = SAL_N_ELEMENTS(aTranslatePropMap_Impl); @@ -275,10 +274,10 @@ static EventInfoHash& getEventTransInfo() pTransProp++; i++; }while(i < nCount && sEventInfo == pTransProp->sEventInfo); - eventTransInfo[sEventInfo] = infoList; + tmp[sEventInfo] = infoList; } - initialised = true; - } + return tmp; + }(); return eventTransInfo; } |