diff options
Diffstat (limited to 'comphelper/source/misc')
-rw-r--r-- | comphelper/source/misc/backupfilehelper.cxx | 26 | ||||
-rw-r--r-- | comphelper/source/misc/threadpool.cxx | 7 |
2 files changed, 14 insertions, 19 deletions
diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index 315fccb1c501..4c7917e96015 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -2044,29 +2044,25 @@ namespace comphelper const std::vector< OUString >& BackupFileHelper::getCustomizationDirNames() { - static std::vector< OUString > aDirNames; - - if (aDirNames.empty()) + static std::vector< OUString > aDirNames = { - aDirNames.emplace_back("config"); // UI config stuff - aDirNames.emplace_back("registry"); // most of the registry stuff - aDirNames.emplace_back("psprint"); // not really needed, can be abandoned - aDirNames.emplace_back("store"); // not really needed, can be abandoned - aDirNames.emplace_back("temp"); // not really needed, can be abandoned - aDirNames.emplace_back("pack"); // own backup dir - } + "config", // UI config stuff + "registry", // most of the registry stuff + "psprint", // not really needed, can be abandoned + "store", // not really needed, can be abandoned + "temp", // not really needed, can be abandoned + "pack" // own backup dir + }; return aDirNames; } const std::vector< OUString >& BackupFileHelper::getCustomizationFileNames() { - static std::vector< OUString > aFileNames; - - if (aFileNames.empty()) + static std::vector< OUString > aFileNames = { - aFileNames.emplace_back("registrymodifications.xcu"); // personal registry stuff - } + "registrymodifications.xcu" // personal registry stuff + }; return aFileNames; } diff --git a/comphelper/source/misc/threadpool.cxx b/comphelper/source/misc/threadpool.cxx index e66d1d18f24e..46c144af8dfd 100644 --- a/comphelper/source/misc/threadpool.cxx +++ b/comphelper/source/misc/threadpool.cxx @@ -109,8 +109,7 @@ ThreadPool& ThreadPool::getSharedOptimalPool() sal_Int32 ThreadPool::getPreferredConcurrency() { - static sal_Int32 ThreadCount = 0; - if (ThreadCount == 0) + static sal_Int32 ThreadCount = [&]() { const sal_Int32 nHardThreads = std::max(std::thread::hardware_concurrency(), 1U); sal_Int32 nThreads = nHardThreads; @@ -122,8 +121,8 @@ sal_Int32 ThreadPool::getPreferredConcurrency() } nThreads = std::min(nHardThreads, nThreads); - ThreadCount = std::max<sal_Int32>(nThreads, 1); - } + return std::max<sal_Int32>(nThreads, 1); + }(); return ThreadCount; } |