summaryrefslogtreecommitdiff
path: root/sal/rtl/cmdargs.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-02 10:58:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-02 20:06:15 +0200
commit4acb0e7f05fa7fe05f990786e0483e20962af1d9 (patch)
tree03ca9e43ae3118c3cf97efecda3b21649ae9ed69 /sal/rtl/cmdargs.cxx
parentd8af42ec5004c8cdb57b6aa60a0f811cf61ad355 (diff)
loplugin:flatten in sal
Change-Id: Icc30c79d599486203c8f763cd5ff43059f0bb910 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91556 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal/rtl/cmdargs.cxx')
-rw-r--r--sal/rtl/cmdargs.cxx46
1 files changed, 23 insertions, 23 deletions
diff --git a/sal/rtl/cmdargs.cxx b/sal/rtl/cmdargs.cxx
index 2d39aebd57c8..8eb328258dfe 100644
--- a/sal/rtl/cmdargs.cxx
+++ b/sal/rtl/cmdargs.cxx
@@ -48,31 +48,31 @@ ArgHolder argHolder;
void init()
{
osl::MutexGuard guard( osl::Mutex::getGlobalMutex() );
- if (!g_ppCommandArgs)
- {
- sal_Int32 i, n = osl_getCommandArgCount();
+ if (g_ppCommandArgs)
+ return;
+
+ sal_Int32 i, n = osl_getCommandArgCount();
- g_ppCommandArgs =
- static_cast<rtl_uString**>(rtl_allocateZeroMemory (n * sizeof(rtl_uString*)));
- for (i = 0; i < n; i++)
+ g_ppCommandArgs =
+ static_cast<rtl_uString**>(rtl_allocateZeroMemory (n * sizeof(rtl_uString*)));
+ for (i = 0; i < n; i++)
+ {
+ rtl_uString * pArg = nullptr;
+ osl_getCommandArg (i, &pArg);
+ if ((pArg->buffer[0] == '-' || pArg->buffer[0] == '/') &&
+ pArg->buffer[1] == 'e' &&
+ pArg->buffer[2] == 'n' &&
+ pArg->buffer[3] == 'v' &&
+ pArg->buffer[4] == ':' &&
+ rtl_ustr_indexOfChar (&(pArg->buffer[5]), '=') >= 0 )
+ {
+ // ignore.
+ rtl_uString_release (pArg);
+ }
+ else
{
- rtl_uString * pArg = nullptr;
- osl_getCommandArg (i, &pArg);
- if ((pArg->buffer[0] == '-' || pArg->buffer[0] == '/') &&
- pArg->buffer[1] == 'e' &&
- pArg->buffer[2] == 'n' &&
- pArg->buffer[3] == 'v' &&
- pArg->buffer[4] == ':' &&
- rtl_ustr_indexOfChar (&(pArg->buffer[5]), '=') >= 0 )
- {
- // ignore.
- rtl_uString_release (pArg);
- }
- else
- {
- // assign.
- g_ppCommandArgs[g_nCommandArgCount++] = pArg;
- }
+ // assign.
+ g_ppCommandArgs[g_nCommandArgCount++] = pArg;
}
}
}