[Libreoffice-commits] core.git: stoc/source
Julien Nabet
serval2412 at yahoo.fr
Sat Nov 4 20:43:55 UTC 2017
stoc/source/corereflection/base.hxx | 6 ++---
stoc/source/corereflection/crbase.cxx | 8 +++---
stoc/source/corereflection/crefl.cxx | 6 +----
stoc/source/implementationregistration/implreg.cxx | 25 ++++++++-------------
4 files changed, 19 insertions(+), 26 deletions(-)
New commits:
commit 2345f00899da2cb4624ab07bd92d139adcdb74e5
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Sat Nov 4 15:02:44 2017 +0100
Replace lists by vectors (stoc)
Change-Id: Ifb5dc253186b7cc8f37d843e600addcc579c77e6
Reviewed-on: https://gerrit.libreoffice.org/44299
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
Tested-by: Julien Nabet <serval2412 at yahoo.fr>
diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx
index 8c01dd3ddf0c..fe15a10a75ac 100644
--- a/stoc/source/corereflection/base.hxx
+++ b/stoc/source/corereflection/base.hxx
@@ -39,7 +39,7 @@
#include "lrucache.hxx"
#ifdef TEST_LIST_CLASSES
-#include <list>
+#include <vector>
#include <algorithm>
#endif
#include <unordered_map>
@@ -59,8 +59,8 @@ namespace stoc_corefl
{
#ifdef TEST_LIST_CLASSES
-typedef std::list< OUString > ClassNameList;
-extern ClassNameList g_aClassNames;
+typedef std::vector< OUString > ClassNameVector;
+extern ClassNameVector g_aClassNames;
#endif
diff --git a/stoc/source/corereflection/crbase.cxx b/stoc/source/corereflection/crbase.cxx
index 58439f67deb2..5b96e97db576 100644
--- a/stoc/source/corereflection/crbase.cxx
+++ b/stoc/source/corereflection/crbase.cxx
@@ -29,7 +29,7 @@ namespace stoc_corefl
{
#ifdef TEST_LIST_CLASSES
-ClassNameList g_aClassNames;
+ClassNameVector g_aClassNames;
#endif
@@ -65,9 +65,9 @@ IdlClassImpl::IdlClassImpl( IdlReflectionServiceImpl * pReflection,
}
#ifdef TEST_LIST_CLASSES
- ClassNameList::const_iterator iFind( std::find( g_aClassNames.begin(), g_aClassNames.end(), _aName ) );
+ ClassNameVector::const_iterator iFind( std::find( g_aClassNames.begin(), g_aClassNames.end(), _aName ) );
OSL_ENSURE( iFind == g_aClassNames.end(), "### idl class already exists!" );
- g_aClassNames.push_front( _aName );
+ g_aClassNames.insert(g_aClassNames.begin(), _aName);
#endif
}
@@ -78,7 +78,7 @@ IdlClassImpl::~IdlClassImpl()
m_xReflection.clear();
#ifdef TEST_LIST_CLASSES
- ClassNameList::iterator iFind( std::find( g_aClassNames.begin(), g_aClassNames.end(), _aName ) );
+ ClassNameVector::iterator iFind( std::find( g_aClassNames.begin(), g_aClassNames.end(), _aName ) );
OSL_ENSURE( iFind != g_aClassNames.end(), "### idl class does not exist!" );
g_aClassNames.erase( iFind );
#endif
diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx
index 8982b768a684..1621ecb6627e 100644
--- a/stoc/source/corereflection/crefl.cxx
+++ b/stoc/source/corereflection/crefl.cxx
@@ -114,11 +114,9 @@ void IdlReflectionServiceImpl::dispose()
_aElements.clear();
#ifdef TEST_LIST_CLASSES
OSL_ENSURE( g_aClassNames.empty(), "### idl classes still alive!" );
- ClassNameList::const_iterator iPos( g_aClassNames.begin() );
- while (iPos != g_aClassNames.end())
+ for (auto const& className : g_aClassNames)
{
- OUString aName( *iPos );
- ++iPos;
+ OUString aName(className);
}
#endif
}
diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx
index d9beabfe48b7..3a86e6c864d9 100644
--- a/stoc/source/implementationregistration/implreg.cxx
+++ b/stoc/source/implementationregistration/implreg.cxx
@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <string.h>
-#include <list>
+#include <vector>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/weak.hxx>
@@ -661,7 +661,7 @@ void prepareUserKeys(const Reference < XSimpleRegistry >& xDest,
void deleteAllImplementations( const Reference < XSimpleRegistry >& xReg,
const Reference < XRegistryKey >& xSource,
const OUString& locationUrl,
- std::list<OUString> & implNames)
+ std::vector<OUString> & implNames)
// throw (InvalidRegistryException, RuntimeException)
{
Sequence < Reference < XRegistryKey > > subKeys = xSource->openKeys();
@@ -747,7 +747,7 @@ void deleteAllImplementations( const Reference < XSimpleRegistry >& xReg,
void delete_all_singleton_entries(
Reference < registry::XRegistryKey > const & xSingletons_section,
- ::std::list< OUString > const & impl_names )
+ ::std::vector< OUString > const & impl_names )
// throw (InvalidRegistryException, RuntimeException)
{
Sequence< Reference< registry::XRegistryKey > > singletons( xSingletons_section->openKeys() );
@@ -774,11 +774,9 @@ void delete_all_singleton_entries(
{
OUString const & registered_implname = p[ n ];
- ::std::list< OUString >::const_iterator iPos( impl_names.begin() );
- ::std::list< OUString >::const_iterator const iEnd( impl_names.end() );
- for ( ; iPos != iEnd; ++iPos )
+ for (auto const& impl_name : impl_names)
{
- if (*iPos == registered_implname)
+ if (impl_name == registered_implname)
{
registered_implnames[ n ] = p[ nNewLength -1 ];
--nNewLength;
@@ -1134,7 +1132,7 @@ void prepareRegistry(
void findImplementations( const Reference < XRegistryKey > & xSource,
- std::list <OUString>& implNames)
+ std::vector<OUString>& implNames)
{
bool isImplKey = false;
@@ -1563,7 +1561,7 @@ Sequence< OUString > ImplementationRegistration::getImplementations(
}
if (xAct->writeRegistryInfo(xImpl, implementationLoaderUrl, locationUrl))
{
- std::list <OUString> implNames;
+ std::vector<OUString> implNames;
findImplementations(xImpl, implNames);
@@ -1610,7 +1608,7 @@ void ImplementationRegistration::doRevoke(
{
if( xDest.is() )
{
- std::list<OUString> aNames;
+ std::vector<OUString> aNames;
const StringPool &pool = spool();
Reference < XRegistryKey > xRootKey( xDest->getRootKey() );
@@ -1625,12 +1623,9 @@ void ImplementationRegistration::doRevoke(
xKey = xRootKey->openKey( pool.slash_SERVICES );
if (xKey.is())
{
- std::list<OUString>::const_iterator iter = aNames.begin();
-
- while (iter != aNames.end())
+ for (auto const& name : aNames)
{
- deleteAllServiceEntries(xDest, xKey, *iter);
- ++iter;
+ deleteAllServiceEntries(xDest, xKey, name);
}
}
More information about the Libreoffice-commits
mailing list