[Libreoffice-commits] core.git: sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Nov 24 13:59:35 UTC 2018
sw/source/core/unocore/unodraw.cxx | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
New commits:
commit aa1398cc5c4453d1c7ca97eea0d536796de93bae
Author: Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Sat Nov 24 07:50:17 2018 +0100
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Nov 24 14:59:16 2018 +0100
Replace list by vector in unodraw.cxx (sw)
Since m_aShapes is filled once during construction of SwXShapesEnumeration
with n times call to insert_iterator (equivalent here to a push_front)
then retrieving next element with begin() + pop_front
we can simplify this by using a vector with:
- n push_back during ctr
- back() + pop_back in nextElement()
Change-Id: I089c5fdfd59934b6cc1e392e9f0703b1ffaa234e
Reviewed-on: https://gerrit.libreoffice.org/63928
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index e2d61dc8abe1..1235469996ec 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -390,8 +390,7 @@ namespace
: public SwSimpleEnumeration_Base
{
private:
- typedef std::list< css::uno::Any > shapescontainer_t;
- shapescontainer_t m_aShapes;
+ std::vector< css::uno::Any > m_aShapes;
protected:
virtual ~SwXShapesEnumeration() override {};
public:
@@ -412,12 +411,12 @@ SwXShapesEnumeration::SwXShapesEnumeration(SwXDrawPage* const pDrawPage)
: m_aShapes()
{
SolarMutexGuard aGuard;
- std::insert_iterator<shapescontainer_t> pInserter = std::insert_iterator<shapescontainer_t>(m_aShapes, m_aShapes.begin());
sal_Int32 nCount = pDrawPage->getCount();
+ m_aShapes.reserve(nCount);
for(sal_Int32 nIdx = 0; nIdx < nCount; nIdx++)
{
uno::Reference<drawing::XShape> xShape(pDrawPage->getByIndex(nIdx), uno::UNO_QUERY);
- *pInserter++ = uno::makeAny(xShape);
+ m_aShapes.push_back(uno::makeAny(xShape));
}
}
@@ -432,8 +431,8 @@ uno::Any SwXShapesEnumeration::nextElement()
SolarMutexGuard aGuard;
if(m_aShapes.empty())
throw container::NoSuchElementException();
- uno::Any aResult = *m_aShapes.begin();
- m_aShapes.pop_front();
+ uno::Any aResult = m_aShapes.back();
+ m_aShapes.pop_back();
return aResult;
}
More information about the Libreoffice-commits
mailing list