[Libreoffice-commits] core.git: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Dec 17 10:09:01 UTC 2018


 sw/source/uibase/dbui/dbmgr.cxx |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

New commits:
commit e8b57d319cfd46816cc41aeccbcb6aa4a2f7cdef
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Mon Dec 17 09:46:44 2018 +0100
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Dec 17 11:08:39 2018 +0100

    Simplify static initializer
    
    Change-Id: I82d5e2ad7373fb9d39aa087426ea80ca4559b556
    Reviewed-on: https://gerrit.libreoffice.org/65245
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index b7956cc7ec11..09f88dd03632 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1172,16 +1172,12 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
     const OUString sDescriptorPrefix = sPrefix_;
 
     // Setup for dumping debugging documents
-    static const char *sMaxDumpDocs = nullptr;
-    static sal_Int32 nMaxDumpDocs = 0;
-    if (!sMaxDumpDocs)
-    {
-        sMaxDumpDocs = getenv("SW_DEBUG_MAILMERGE_DOCS");
-        if (!sMaxDumpDocs)
-            sMaxDumpDocs = "";
+    static const sal_Int32 nMaxDumpDocs = []() {
+        if (const char* sEnv = getenv("SW_DEBUG_MAILMERGE_DOCS"))
+            return OUString(sEnv, strlen(sEnv), osl_getThreadTextEncoding()).toInt32();
         else
-            nMaxDumpDocs = OUString(sMaxDumpDocs, strlen(sMaxDumpDocs), osl_getThreadTextEncoding()).toInt32();
-    }
+            return sal_Int32(0);
+    }();
 
     ::rtl::Reference< MailDispatcher >          xMailDispatcher;
     ::rtl::Reference< IMailDispatcherListener > xMailListener;


More information about the Libreoffice-commits mailing list