forked from qt-creator/qt-creator
CorePlugin: Avoid using keys()
Instead, iterate directly over the container. Change-Id: I508126a6afc8f4354bc7810e09f57866d1d1d2ab Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1094,9 +1094,9 @@ void DocumentManager::checkForReload()
|
||||
}
|
||||
currentStates.insert(fileKey, state);
|
||||
changeTypes.insert(fileKey, type);
|
||||
QList<IDocument *> documents = d->m_states.value(fileKey).lastUpdatedState.keys();
|
||||
for (IDocument *document : documents)
|
||||
changedIDocuments.insert(document);
|
||||
const auto docs = d->m_states.value(fileKey).lastUpdatedState;
|
||||
for (auto it = docs.begin(); it != docs.end(); ++it)
|
||||
changedIDocuments.insert(it.key());
|
||||
}
|
||||
|
||||
// clean up. do this before we may enter the main loop, otherwise we would
|
||||
|
||||
@@ -209,14 +209,15 @@ void remove(const QString &key)
|
||||
const QString effectiveKey = d->effectiveKey(key);
|
||||
|
||||
// Remove keys from the cache
|
||||
const QStringList keys = d->m_settings.keys();
|
||||
for (const QString &k : keys) {
|
||||
for (auto it = d->m_settings.cbegin(); it != d->m_settings.cend(); ) {
|
||||
// Either it's an exact match, or it matches up to a /
|
||||
const QString k = it.key();
|
||||
if (k.startsWith(effectiveKey)
|
||||
&& (k.length() == effectiveKey.length()
|
||||
|| k.at(effectiveKey.length()) == QLatin1Char('/')))
|
||||
{
|
||||
d->m_settings.remove(k);
|
||||
|| k.at(effectiveKey.length()) == QLatin1Char('/'))) {
|
||||
it = d->m_settings.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user