summaryrefslogtreecommitdiff
path: root/src/network/kernel/qhostinfo.cpp
diff options
context:
space:
mode:
authorJędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>2014-12-15 21:46:42 +0100
committerJędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>2015-01-13 12:47:24 +0100
commit9e53325cfc9c099c344327e12f59f2e1f5a0a9e7 (patch)
treece5b816ecc315eec8c0696e801d0e2f0283c2223 /src/network/kernel/qhostinfo.cpp
parent0d4485fd78d5a14797c3511ecf808fcfa0768ac9 (diff)
downloadqtbase-9e53325cfc9c099c344327e12f59f2e1f5a0a9e7.tar.gz
Avoid double cache lookup in QHostInfoCache
Change-Id: If5ef2d2f117fe8c1abdf361f1122e32075e14385 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/network/kernel/qhostinfo.cpp')
-rw-r--r--src/network/kernel/qhostinfo.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp
index a9a80054f4..68752660ba 100644
--- a/src/network/kernel/qhostinfo.cpp
+++ b/src/network/kernel/qhostinfo.cpp
@@ -724,8 +724,7 @@ QHostInfo QHostInfoCache::get(const QString &name, bool *valid)
QMutexLocker locker(&this->mutex);
*valid = false;
- if (cache.contains(name)) {
- QHostInfoCacheElement *element = cache.object(name);
+ if (QHostInfoCacheElement *element = cache.object(name)) {
if (element->age.elapsed() < max_age*1000)
*valid = true;
return element->info;