Fix inefficient code foreaching on container.values()
Saves one full iteration and memory allocation. Change-Id: Ice527499b5f5f62bd1e47d76fdf40119948ee3a1 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>bb10
parent
712d605c43
commit
e326cd8d4d
|
|
@ -100,7 +100,7 @@ QCocoaPrintDevice::~QCocoaPrintDevice()
|
|||
{
|
||||
if (m_ppd)
|
||||
ppdClose(m_ppd);
|
||||
foreach (PMPaper paper, m_macPapers.values())
|
||||
foreach (PMPaper paper, m_macPapers)
|
||||
PMRelease(paper);
|
||||
// Releasing the session appears to also release the printer
|
||||
if (m_session)
|
||||
|
|
@ -154,7 +154,7 @@ QPageSize QCocoaPrintDevice::createPageSize(const PMPaper &paper) const
|
|||
void QCocoaPrintDevice::loadPageSizes() const
|
||||
{
|
||||
m_pageSizes.clear();
|
||||
foreach (PMPaper paper, m_macPapers.values())
|
||||
foreach (PMPaper paper, m_macPapers)
|
||||
PMRelease(paper);
|
||||
m_macPapers.clear();
|
||||
m_printableMargins.clear();
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ QCocoaTouch::getCurrentTouchPointList(NSEvent *event, bool acceptSingleTouch)
|
|||
if (_touchCount != _currentTouches.size()) {
|
||||
// Remove all instances, and basically start from scratch:
|
||||
touchPoints.clear();
|
||||
foreach (QCocoaTouch *qcocoaTouch, _currentTouches.values()) {
|
||||
foreach (QCocoaTouch *qcocoaTouch, _currentTouches) {
|
||||
if (!_updateInternalStateOnly) {
|
||||
qcocoaTouch->_touchPoint.state = Qt::TouchPointReleased;
|
||||
touchPoints.insert(qcocoaTouch->_touchPoint.id, qcocoaTouch->_touchPoint);
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ QAccessibleTabBar::QAccessibleTabBar(QWidget *w)
|
|||
|
||||
QAccessibleTabBar::~QAccessibleTabBar()
|
||||
{
|
||||
foreach (QAccessible::Id id, m_childInterfaces.values())
|
||||
foreach (QAccessible::Id id, m_childInterfaces)
|
||||
QAccessible::deleteAccessibleInterface(id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ bool QAccessibleTable::isValid() const
|
|||
|
||||
QAccessibleTable::~QAccessibleTable()
|
||||
{
|
||||
Q_FOREACH (QAccessible::Id id, childToId.values())
|
||||
Q_FOREACH (QAccessible::Id id, childToId)
|
||||
QAccessible::deleteAccessibleInterface(id);
|
||||
}
|
||||
|
||||
|
|
@ -532,7 +532,7 @@ void QAccessibleTable::modelChange(QAccessibleTableModelChangeEvent *event)
|
|||
|
||||
switch (event->modelChangeType()) {
|
||||
case QAccessibleTableModelChangeEvent::ModelReset:
|
||||
Q_FOREACH (QAccessible::Id id, childToId.values())
|
||||
Q_FOREACH (QAccessible::Id id, childToId)
|
||||
QAccessible::deleteAccessibleInterface(id);
|
||||
childToId.clear();
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue