diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-02-15 05:18:26 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-02-15 05:21:34 (GMT) |
commit | 4fb59e0a8d40083f545dd43a370bd6d7b7b4cd35 (patch) | |
tree | 54cdfa22619e446ed349e8c1486e6cea3e64c707 /src/network/bearer/qnetworkconfigmanager_p.cpp | |
parent | 4089401868dd62972a750c3e668a2998071de97c (diff) | |
download | Qt-4fb59e0a8d40083f545dd43a370bd6d7b7b4cd35.zip Qt-4fb59e0a8d40083f545dd43a370bd6d7b7b4cd35.tar.gz Qt-4fb59e0a8d40083f545dd43a370bd6d7b7b4cd35.tar.bz2 |
Optimise iterations over QHash.
Diffstat (limited to 'src/network/bearer/qnetworkconfigmanager_p.cpp')
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager_p.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 01a85a5..b7a30b8 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -244,16 +244,19 @@ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration( QNetworkConfigurationPrivatePointer firstDiscovered; foreach (QBearerEngine *engine, sessionEngines) { - foreach (const QString &id, engine->snapConfigurations.keys()) { - QNetworkConfigurationPrivatePointer ptr = engine->snapConfigurations.value(id); + QHash<QString, QNetworkConfigurationPrivatePointer>::Iterator it; + QHash<QString, QNetworkConfigurationPrivatePointer>::Iterator end; - if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + for (it = engine->snapConfigurations.begin(), end = engine->snapConfigurations.end(); + it != end; ++it) { + if ((it.value()->state & QNetworkConfiguration::Active) == + QNetworkConfiguration::Active) { QNetworkConfiguration config; - config.d = ptr; + config.d = it.value(); return config; - } else if ((ptr->state & QNetworkConfiguration::Discovered) == + } else if ((it.value()->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { - firstDiscovered = ptr; + firstDiscovered = it.value(); } } } @@ -269,16 +272,19 @@ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration( firstDiscovered.reset(); foreach (QBearerEngine *engine, sessionEngines) { - foreach (const QString &id, engine->accessPointConfigurations.keys()) { - QNetworkConfigurationPrivatePointer ptr = engine->accessPointConfigurations.value(id); + QHash<QString, QNetworkConfigurationPrivatePointer>::Iterator it; + QHash<QString, QNetworkConfigurationPrivatePointer>::Iterator end; - if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + for (it = engine->accessPointConfigurations.begin(), + end = engine->accessPointConfigurations.end(); it != end; ++it) { + if ((it.value()->state & QNetworkConfiguration::Active) == + QNetworkConfiguration::Active) { QNetworkConfiguration config; - config.d = ptr; + config.d = it.value(); return config; - } else if ((ptr->state & QNetworkConfiguration::Discovered) == + } else if ((it.value()->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { - firstDiscovered = ptr; + firstDiscovered = it.value(); } } } |