diff options
Diffstat (limited to 'sal/rtl')
-rw-r--r-- | sal/rtl/bootstrap.cxx | 17 | ||||
-rw-r--r-- | sal/rtl/hash.cxx | 7 |
2 files changed, 9 insertions, 15 deletions
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx index 897de890d890..9c6675586ef9 100644 --- a/sal/rtl/bootstrap.cxx +++ b/sal/rtl/bootstrap.cxx @@ -155,10 +155,9 @@ static bool getFromCommandLineArgs( { OSL_ASSERT(value); - static NameValueVector *pNameValueVector = nullptr; - if (!pNameValueVector) + static NameValueVector nameValueVector = [&]() { - static NameValueVector nameValueVector; + NameValueVector tmp; sal_Int32 nArgCount = osl_getCommandArgCount(); for(sal_Int32 i = 0; i < nArgCount; ++ i) @@ -189,18 +188,18 @@ static bool getFromCommandLineArgs( nameValue.sValue = nameValue.sValue.copy(0,nameValue.sValue.getLength()-1); } - nameValueVector.push_back( nameValue ); + tmp.push_back( nameValue ); } } rtl_uString_release( pArg ); - } - pNameValueVector = &nameValueVector; - } + }; + return tmp; + }(); bool found = false; - for(NameValueVector::iterator ii = pNameValueVector->begin(); - ii != pNameValueVector->end(); + for(NameValueVector::iterator ii = nameValueVector.begin(); + ii != nameValueVector.end(); ++ii) { if ((*ii).sName == key) diff --git a/sal/rtl/hash.cxx b/sal/rtl/hash.cxx index e12095f3d9e5..489030f62861 100644 --- a/sal/rtl/hash.cxx +++ b/sal/rtl/hash.cxx @@ -40,12 +40,7 @@ static void rtl_str_hash_free(StringHashTable *pHash); static StringHashTable * getHashTable() { - static StringHashTable *pInternPool = nullptr; - if (!pInternPool) - { - static StringHashTable* pHash = rtl_str_hash_new(1024); - pInternPool = pHash; - } + static StringHashTable* pInternPool = rtl_str_hash_new(1024); return pInternPool; } |