[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r1358: GeoIpCache::contains() already performs these checks, so we (trunk/src/util/geoip)
Author: edmanm
Date: 2006-10-19 02:58:12 -0400 (Thu, 19 Oct 2006)
New Revision: 1358
Modified:
trunk/src/util/geoip/geoipcache.cpp
Log:
GeoIpCache::contains() already performs these checks, so we might as well use
that method instead of writing them twice.
Modified: trunk/src/util/geoip/geoipcache.cpp
===================================================================
--- trunk/src/util/geoip/geoipcache.cpp 2006-10-19 06:39:56 UTC (rev 1357)
+++ trunk/src/util/geoip/geoipcache.cpp 2006-10-19 06:58:12 UTC (rev 1358)
@@ -134,12 +134,8 @@
GeoIp
GeoIpCache::geoip(QHostAddress ip)
{
- quint32 ipv4 = ip.toIPv4Address();
- if (_cache.contains(ipv4)) {
- GeoIpCacheItem cacheItem = _cache.value(ipv4);
- if (!cacheItem.isExpired()) {
- return cacheItem.geoip();
- }
+ if (this->contains(ip)) {
+ return _cache.value(ip.toIPv4Address()).geoip();
}
return GeoIp();
}