forked from qt-creator/qt-creator
Avoid value-list creation when iterating over maps.
Change-Id: I704ba93d01ffababb405bc801f07a845631930cc Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -336,7 +336,7 @@ QList<Command *> ActionManager::commands()
|
||||
{
|
||||
// transform list of CommandPrivate into list of Command
|
||||
QList<Command *> result;
|
||||
foreach (Command *cmd, d->m_idCmdMap.values())
|
||||
foreach (Command *cmd, d->m_idCmdMap)
|
||||
result << cmd;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ void CppEditorSupport::onDiagnosticsChanged()
|
||||
QList<Document::DiagnosticMessage> allDiagnostics;
|
||||
{
|
||||
QMutexLocker locker(&m_diagnosticsMutex);
|
||||
foreach (const QList<Document::DiagnosticMessage> &msgs, m_allDiagnostics.values())
|
||||
foreach (const QList<Document::DiagnosticMessage> &msgs, m_allDiagnostics)
|
||||
allDiagnostics.append(msgs);
|
||||
}
|
||||
|
||||
|
||||
@@ -433,7 +433,7 @@ QVariantMap Kit::toMap() const
|
||||
data.insert(QLatin1String(ICON_KEY), d->m_iconPath.toString());
|
||||
|
||||
QStringList mutableInfo;
|
||||
foreach (const Core::Id &id, d->m_mutable.values())
|
||||
foreach (const Core::Id &id, d->m_mutable)
|
||||
mutableInfo << id.toString();
|
||||
data.insert(QLatin1String(MUTABLE_INFO_KEY), mutableInfo);
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ void TargetSetupPage::setKitSelected(Core::Id id, bool selected)
|
||||
|
||||
bool TargetSetupPage::isComplete() const
|
||||
{
|
||||
foreach (TargetSetupWidget *widget, m_widgets.values())
|
||||
foreach (TargetSetupWidget *widget, m_widgets)
|
||||
if (widget->isKitSelected())
|
||||
return true;
|
||||
return false;
|
||||
@@ -275,7 +275,7 @@ void TargetSetupPage::setupWidgets()
|
||||
|
||||
void TargetSetupPage::reset()
|
||||
{
|
||||
foreach (TargetSetupWidget *widget, m_widgets.values()) {
|
||||
foreach (TargetSetupWidget *widget, m_widgets) {
|
||||
Kit *k = widget->kit();
|
||||
if (!k)
|
||||
continue;
|
||||
@@ -386,7 +386,7 @@ void TargetSetupPage::handleKitUpdate(Kit *k)
|
||||
void TargetSetupPage::selectAtLeastOneKit()
|
||||
{
|
||||
bool atLeastOneKitSelected = false;
|
||||
foreach (TargetSetupWidget *w, m_widgets.values()) {
|
||||
foreach (TargetSetupWidget *w, m_widgets) {
|
||||
if (w->isKitSelected()) {
|
||||
atLeastOneKitSelected = true;
|
||||
break;
|
||||
@@ -514,7 +514,7 @@ TargetSetupWidget *TargetSetupPage::addWidget(Kit *k)
|
||||
bool TargetSetupPage::setupProject(Project *project)
|
||||
{
|
||||
QList<const BuildInfo *> toSetUp; // Pointers are managed by the widgets!
|
||||
foreach (TargetSetupWidget *widget, m_widgets.values()) {
|
||||
foreach (TargetSetupWidget *widget, m_widgets) {
|
||||
if (!widget->isKitSelected())
|
||||
continue;
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ bool QV8ProfilerDataModel::isEmpty() const
|
||||
|
||||
QV8EventData *QV8ProfilerDataModel::v8EventDescription(int eventId) const
|
||||
{
|
||||
foreach (QV8EventData *event, d->v8EventHash.values()) {
|
||||
foreach (QV8EventData *event, d->v8EventHash) {
|
||||
if (event->eventId == eventId)
|
||||
return event;
|
||||
}
|
||||
@@ -235,7 +235,7 @@ void QV8ProfilerDataModel::QV8ProfilerDataModelPrivate::collectV8Statistics()
|
||||
if (!v8EventHash.isEmpty()) {
|
||||
double totalTimes = v8MeasuredTime;
|
||||
double selfTimes = 0;
|
||||
foreach (QV8EventData *v8event, v8EventHash.values()) {
|
||||
foreach (const QV8EventData *v8event, v8EventHash) {
|
||||
selfTimes += v8event->selfTime;
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ void QV8ProfilerDataModel::QV8ProfilerDataModelPrivate::collectV8Statistics()
|
||||
*v8EventHash[rootEventHash] = v8RootEvent;
|
||||
}
|
||||
|
||||
foreach (QV8EventData *v8event, v8EventHash.values()) {
|
||||
foreach (QV8EventData *v8event, v8EventHash) {
|
||||
v8event->totalPercent = v8event->totalTime * 100.0 / totalTimes;
|
||||
v8event->SelfTimeInPercent = v8event->selfTime * 100.0 / selfTimes;
|
||||
}
|
||||
@@ -300,7 +300,7 @@ void QV8ProfilerDataModel::save(QXmlStreamWriter &stream)
|
||||
{
|
||||
stream.writeStartElement(QLatin1String("v8profile")); // v8 profiler output
|
||||
stream.writeAttribute(QLatin1String("totalTime"), QString::number(d->v8MeasuredTime));
|
||||
foreach (QV8EventData *v8event, d->v8EventHash.values()) {
|
||||
foreach (const QV8EventData *v8event, d->v8EventHash) {
|
||||
stream.writeStartElement(QLatin1String("event"));
|
||||
stream.writeAttribute(QLatin1String("index"),
|
||||
QString::number(
|
||||
@@ -319,7 +319,7 @@ void QV8ProfilerDataModel::save(QXmlStreamWriter &stream)
|
||||
QStringList childrenIndexes;
|
||||
QStringList childrenTimes;
|
||||
QStringList parentTimes;
|
||||
foreach (QV8EventSub *v8child, v8event->childrenHash.values()) {
|
||||
foreach (const QV8EventSub *v8child, v8event->childrenHash) {
|
||||
childrenIndexes << QString::number(v8child->reference->eventId);
|
||||
childrenTimes << QString::number(v8child->totalTime);
|
||||
parentTimes << QString::number(v8child->totalTime);
|
||||
@@ -468,7 +468,7 @@ void QV8ProfilerDataModel::load(QXmlStreamReader &stream)
|
||||
}
|
||||
}
|
||||
// store v8 events
|
||||
foreach (QV8EventData *storedV8Event, v8eventBuffer.values()) {
|
||||
foreach (QV8EventData *storedV8Event, v8eventBuffer) {
|
||||
storedV8Event->eventHashStr =
|
||||
getHashStringForV8Event(
|
||||
storedV8Event->displayName, storedV8Event->functionName);
|
||||
|
||||
Reference in New Issue
Block a user