[Libreoffice-commits] core.git: desktop/source sw/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Sat Nov 16 10:45:59 UTC 2019
desktop/source/app/app.cxx | 18 ++++++------------
sw/source/filter/ww8/wrtw8num.cxx | 15 ++++++---------
2 files changed, 12 insertions(+), 21 deletions(-)
New commits:
commit 130c1ae09451c268fcd4f2d55f65ac7dc9581342
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Nov 16 10:36:24 2019 +0200
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sat Nov 16 11:45:21 2019 +0100
Replace some std::once with static initializers
Change-Id: I6234bc252dac5b1c29e3f1ef844cf51f56aaa7ac
Reviewed-on: https://gerrit.libreoffice.org/82970
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index ef94b0d96da3..31f7abbf9b4e 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -394,18 +394,12 @@ namespace
OUString ReplaceStringHookProc( const OUString& rStr )
{
- const static OUString sBuildId(utl::Bootstrap::getBuildIdData("development"));
- static OUString sBrandName, sVersion, sAboutBoxVersion, sAboutBoxVersionSuffix, sExtension;
-
- static std::once_flag aInitOnce;
- std::call_once(aInitOnce, []
- {
- sBrandName = utl::ConfigManager::getProductName();
- sVersion = utl::ConfigManager::getProductVersion();
- sAboutBoxVersion = utl::ConfigManager::getAboutBoxProductVersion();
- sAboutBoxVersionSuffix = utl::ConfigManager::getAboutBoxProductVersionSuffix();
- sExtension = utl::ConfigManager::getProductExtension();
- } );
+ const static OUString sBuildId(utl::Bootstrap::getBuildIdData("development")),
+ sBrandName(utl::ConfigManager::getProductName()),
+ sVersion(utl::ConfigManager::getProductVersion()),
+ sAboutBoxVersion(utl::ConfigManager::getAboutBoxProductVersion()),
+ sAboutBoxVersionSuffix(utl::ConfigManager::getAboutBoxProductVersionSuffix()),
+ sExtension(utl::ConfigManager::getProductExtension());
OUString sRet(rStr);
if (sRet.indexOf("%PRODUCT") != -1 || sRet.indexOf("%ABOUTBOX") != -1)
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index d9f284c3380b..35b8c60a89b7 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -40,6 +40,7 @@
#include "ww8par.hxx"
#include <mutex>
+#include <numeric>
using namespace ::com::sun::star;
using namespace sw::types;
@@ -444,15 +445,11 @@ void MSWordExportBase::NumberingLevel(
SwNumRule const& rRule, sal_uInt8 const nLvl)
{
// prepare the NodeNum to generate the NumString
- static SwNumberTree::tNumberVector aNumVector;
- static std::once_flag aInitOnce;
- std::call_once(aInitOnce, []
- {
- for (int n = 0; n < WW8ListManager::nMaxLevel; ++n)
- {
- aNumVector.push_back( n );
- }
- });
+ static const SwNumberTree::tNumberVector aNumVector = [] {
+ SwNumberTree::tNumberVector vec(WW8ListManager::nMaxLevel);
+ std::iota(vec.begin(), vec.end(), 0);
+ return vec;
+ }();
// write the static data of the SwNumFormat of this level
sal_uInt8 aNumLvlPos[WW8ListManager::nMaxLevel] = { 0,0,0,0,0,0,0,0,0 };
More information about the Libreoffice-commits
mailing list