diff options
| author | 2021-04-06 20:06:18 +0100 | |
|---|---|---|
| committer | 2021-04-07 10:36:11 +0100 | |
| commit | 942fd2bcfd384a12c900999fe663202c87319a68 (patch) | |
| tree | c2bad1906af27afbc3c7d96c3e5ca3c27c83f090 /src/modules/m_geoclass.cpp | |
| parent | Merge branch 'insp3' into master. (diff) | |
| download | inspircd++-942fd2bcfd384a12c900999fe663202c87319a68.tar.gz inspircd++-942fd2bcfd384a12c900999fe663202c87319a68.tar.bz2 inspircd++-942fd2bcfd384a12c900999fe663202c87319a68.zip | |
Switch simple iterator loops to use range-based for loops.
Diffstat (limited to 'src/modules/m_geoclass.cpp')
| -rw-r--r-- | src/modules/m_geoclass.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/modules/m_geoclass.cpp b/src/modules/m_geoclass.cpp index bd08712e2..b3872c477 100644 --- a/src/modules/m_geoclass.cpp +++ b/src/modules/m_geoclass.cpp @@ -75,27 +75,22 @@ class ModuleGeoClass return MOD_RES_PASSTHRU; // Counter for the number of users in each country. - typedef std::map<Geolocation::Location*, size_t> CountryCounts; - CountryCounts counts; + std::map<Geolocation::Location*, size_t> counts; // Counter for the number of users in an unknown country. size_t unknown = 0; - const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers(); - for (UserManager::LocalList::const_iterator iter = list.begin(); iter != list.end(); ++iter) + for (auto* user : ServerInstance->Users.GetLocalUsers()) { - Geolocation::Location* location = geoapi ? geoapi->GetLocation(*iter) : NULL; + Geolocation::Location* location = geoapi ? geoapi->GetLocation(user) : nullptr; if (location) counts[location]++; else unknown++; } - for (CountryCounts::const_iterator iter = counts.begin(); iter != counts.end(); ++iter) - { - Geolocation::Location* location = iter->first; - stats.AddRow(RPL_STATSCOUNTRY, iter->second, location->GetCode(), location->GetName()); - } + for (const auto& [location, count] : counts) + stats.AddRow(RPL_STATSCOUNTRY, count, location->GetCode(), location->GetName()); if (unknown) stats.AddRow(RPL_STATSCOUNTRY, unknown, "*", "Unknown Country"); |
