summaryrefslogtreecommitdiff
path: root/src/regchannel.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2023-10-10 21:14:50 +0100
committerSadie Powell <sadie@witchery.services>2023-10-11 15:51:52 +0100
commita3241065c55fd2a69e8793b89a5d0b1a957b3fd0 (patch)
tree82f80ce2f3bbbdc1c1ef05fe611093cf0b34eab6 /src/regchannel.cpp
parentdc371aad6d059dbf7f30f6878c680532bedd4146 (diff)
Start migrating to range-based for loops.
Diffstat (limited to 'src/regchannel.cpp')
-rw-r--r--src/regchannel.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/regchannel.cpp b/src/regchannel.cpp
index 984da55ab..966f3e1b4 100644
--- a/src/regchannel.cpp
+++ b/src/regchannel.cpp
@@ -194,16 +194,16 @@ void ChannelInfo::Serialize(Serialize::Data &data) const
data.SetType("bantype", Serialize::Data::DT_INT); data["bantype"] << this->bantype;
{
Anope::string levels_buffer;
- for (Anope::map<int16_t>::const_iterator it = this->levels.begin(), it_end = this->levels.end(); it != it_end; ++it)
- levels_buffer += it->first + " " + stringify(it->second) + " ";
+ for (const auto &[name, level] : this->levels)
+ levels_buffer += name + " " + stringify(level) + " ";
data["levels"] << levels_buffer;
}
if (this->bi)
data["bi"] << this->bi->nick;
data.SetType("banexpire", Serialize::Data::DT_INT); data["banexpire"] << this->banexpire;
data["memomax"] << this->memos.memomax;
- for (unsigned i = 0; i < this->memos.ignores.size(); ++i)
- data["memoignores"] << this->memos.ignores[i] << " ";
+ for (const auto &ignore : this->memos.ignores)
+ data["memoignores"] << ignore << " ";
Extensible::ExtensibleSerialize(this, this, data);
}
@@ -443,12 +443,10 @@ AccessGroup ChannelInfo::AccessFor(const User *u, bool updateLastUsed)
if (updateLastUsed)
this->last_used = Anope::CurTime;
- for (unsigned i = 0; i < group.paths.size(); ++i)
+ for (auto &p : group.paths)
{
- ChanAccess::Path &p = group.paths[i];
-
- for (unsigned int j = 0; j < p.size(); ++j)
- p[j]->last_seen = Anope::CurTime;
+ for (auto *ca : p)
+ ca->last_seen = Anope::CurTime;
}
}
@@ -688,6 +686,6 @@ void ChannelInfo::RemoveChannelReference(const Anope::string &what)
void ChannelInfo::GetChannelReferences(std::deque<Anope::string> &chans)
{
chans.clear();
- for (Anope::map<int>::iterator it = references.begin(); it != references.end(); ++it)
- chans.push_back(it->first);
+ for (auto &[chan, _] : references)
+ chans.push_back(chan);
}