mirror of
https://github.com/anope/anope.git
synced 2026-07-01 18:26:39 +02:00
Start migrating to range-based for loops.
This commit is contained in:
+13
-13
@@ -146,20 +146,22 @@ enum
|
||||
static void process_mlock(ChannelInfo *ci, uint32_t lock, bool status, uint32_t *limit, Anope::string *key)
|
||||
{
|
||||
ModeLocks *ml = ci->Require<ModeLocks>("modelocks");
|
||||
for (unsigned i = 0; i < (sizeof(mlock_infos) / sizeof(mlock_info)); ++i)
|
||||
if (lock & mlock_infos[i].m)
|
||||
for (auto &mlock_info : mlock_infos)
|
||||
{
|
||||
if (lock & mlock_info.m)
|
||||
{
|
||||
ChannelMode *cm = ModeManager::FindChannelModeByChar(mlock_infos[i].c);
|
||||
ChannelMode *cm = ModeManager::FindChannelModeByChar(mlock_info.c);
|
||||
if (cm && ml)
|
||||
{
|
||||
if (limit && mlock_infos[i].c == 'l')
|
||||
if (limit && mlock_info.c == 'l')
|
||||
ml->SetMLock(cm, status, stringify(*limit));
|
||||
else if (key && mlock_infos[i].c == 'k')
|
||||
else if (key && mlock_info.c == 'k')
|
||||
ml->SetMLock(cm, status, *key);
|
||||
else
|
||||
ml->SetMLock(cm, status);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const char Base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
@@ -449,8 +451,8 @@ static void LoadNicks()
|
||||
|
||||
const Anope::string settings[] = { "killprotect", "kill_quick", "ns_secure", "ns_private", "hide_email",
|
||||
"hide_mask", "hide_quit", "memo_signon", "memo_receive", "autoop", "msg", "ns_keepmodes" };
|
||||
for (unsigned j = 0; j < sizeof(settings) / sizeof(Anope::string); ++j)
|
||||
nc->Shrink<bool>(settings[j].upper());
|
||||
for (const auto &setting : settings)
|
||||
nc->Shrink<bool>(setting.upper());
|
||||
|
||||
char pwbuf[32];
|
||||
READ(read_buffer(pwbuf, f));
|
||||
@@ -752,8 +754,8 @@ static void LoadChannels()
|
||||
|
||||
const Anope::string settings[] = { "keeptopic", "peace", "cs_private", "restricted", "cs_secure", "secureops", "securefounder",
|
||||
"signkick", "signkick_level", "topiclock", "persist", "noautoop", "cs_keepmodes" };
|
||||
for (unsigned j = 0; j < sizeof(settings) / sizeof(Anope::string); ++j)
|
||||
ci->Shrink<bool>(settings[j].upper());
|
||||
for (const auto &setting : settings)
|
||||
ci->Shrink<bool>(setting.upper());
|
||||
|
||||
READ(read_string(buffer, f));
|
||||
ci->SetFounder(NickCore::Find(buffer));
|
||||
@@ -1104,9 +1106,8 @@ static void LoadOper()
|
||||
XLineManager *akill, *sqline, *snline, *szline;
|
||||
akill = sqline = snline = szline = NULL;
|
||||
|
||||
for (std::list<XLineManager *>::iterator it = XLineManager::XLineManagers.begin(), it_end = XLineManager::XLineManagers.end(); it != it_end; ++it)
|
||||
for (auto *xl : XLineManager::XLineManagers)
|
||||
{
|
||||
XLineManager *xl = *it;
|
||||
if (xl->Type() == 'G')
|
||||
akill = xl;
|
||||
else if (xl->Type() == 'Q')
|
||||
@@ -1328,9 +1329,8 @@ class DBOld : public Module
|
||||
|
||||
void OnUplinkSync(Server *s) override
|
||||
{
|
||||
for (registered_channel_map::iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
|
||||
for (auto &[_, ci] : *RegisteredChannelList)
|
||||
{
|
||||
ChannelInfo *ci = it->second;
|
||||
uint32_t *limit = mlock_limit.Get(ci);
|
||||
Anope::string *key = mlock_key.Get(ci);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user