diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-21 11:46:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-21 12:28:23 +0100 |
commit | 48314f25241e014a634dd5371543b90137ffd2bc (patch) | |
tree | c55d6ef485fee3941bc1d3becb106d0dd77e7f2f /connectivity/source/drivers/evoab2 | |
parent | e41667762bfff43f95d1ee71b2d67903e4fdab4e (diff) |
improve function-local statics in basic..cui
Change-Id: If737e8478f6f1c8fffb060ce132d80e0f07ef8ee
Reviewed-on: https://gerrit.libreoffice.org/63701
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity/source/drivers/evoab2')
-rw-r--r-- | connectivity/source/drivers/evoab2/EApi.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx | 12 |
2 files changed, 7 insertions, 9 deletions
diff --git a/connectivity/source/drivers/evoab2/EApi.cxx b/connectivity/source/drivers/evoab2/EApi.cxx index 1830cae593af..41bc62c9ab20 100644 --- a/connectivity/source/drivers/evoab2/EApi.cxx +++ b/connectivity/source/drivers/evoab2/EApi.cxx @@ -173,9 +173,7 @@ bool EApiInit() ESourceRegistry *get_e_source_registry() { - static ESourceRegistry *theInstance; - if (!theInstance) - theInstance = e_source_registry_new_sync(nullptr, nullptr); + static ESourceRegistry *theInstance = e_source_registry_new_sync(nullptr, nullptr); return theInstance; } diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx index ff48493e1f20..004b46245b4d 100644 --- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx +++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx @@ -1017,10 +1017,9 @@ Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( ) ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo); Reference< XResultSet > xResultSet = pResultSet; - static ODatabaseMetaDataResultSet::ORows aRows; - - if(aRows.empty()) + static ODatabaseMetaDataResultSet::ORows aRows = []() { + ODatabaseMetaDataResultSet::ORows tmp; ODatabaseMetaDataResultSet::ORow aRow; aRow.reserve(19); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); @@ -1044,13 +1043,14 @@ Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( ) aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); aRow.push_back(new ORowSetValueDecorator(sal_Int32(10))); - aRows.push_back(aRow); + tmp.push_back(aRow); aRow[1] = new ORowSetValueDecorator(OUString("VARCHAR")); aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR); aRow[3] = new ORowSetValueDecorator(sal_Int32(65535)); - aRows.push_back(aRow); - } + tmp.push_back(aRow); + return tmp; + }(); pResultSet->setRows(aRows); return xResultSet; } |