diff --git a/modules/botserv/bs_badwords.cpp b/modules/botserv/bs_badwords.cpp index 023d0dfb1..981fc302e 100644 --- a/modules/botserv/bs_badwords.cpp +++ b/modules/botserv/bs_badwords.cpp @@ -147,7 +147,7 @@ struct BadWordsImpl final BadWordsImpl::~BadWordsImpl() { - for (list::iterator it = badwords->begin(); it != badwords->end();) + for (auto it = badwords->begin(); it != badwords->end();) { auto *bw = *it; ++it; @@ -160,10 +160,10 @@ BadWordImpl::~BadWordImpl() ChannelInfo *ci = ChannelInfo::Find(chan); if (ci) { - BadWordsImpl *badwords = ci->GetExt(BOTSERV_BAD_WORDS_EXT); + auto *badwords = ci->GetExt(BOTSERV_BAD_WORDS_EXT); if (badwords) { - BadWordsImpl::list::iterator it = std::find(badwords->badwords->begin(), badwords->badwords->end(), this); + auto it = std::find(badwords->badwords->begin(), badwords->badwords->end(), this); if (it != badwords->badwords->end()) badwords->badwords->erase(it); } @@ -193,7 +193,7 @@ Serializable *BadWordTypeImpl::Unserialize(Serializable *obj, Serialize::Data &d bw->word = sword; bw->type = StringToType(n); - BadWordsImpl *bws = ci->Require(BOTSERV_BAD_WORDS_EXT); + auto *bws = ci->Require(BOTSERV_BAD_WORDS_EXT); if (!obj) bws->badwords->push_back(bw); @@ -337,7 +337,7 @@ private: realword = word.substr(0, pos); } - unsigned badwordsmax = Config->GetModule(this->module).Get("badwordsmax"); + auto badwordsmax = Config->GetModule(this->module).Get("badwordsmax"); if (badwords->GetBadWordCount() >= badwordsmax) { source.Reply(_("You can only have %d bad words entries on a channel."), badwordsmax); diff --git a/modules/botserv/bs_kick.cpp b/modules/botserv/bs_kick.cpp index 76a9e152b..7cbbebb43 100644 --- a/modules/botserv/bs_kick.cpp +++ b/modules/botserv/bs_kick.cpp @@ -51,7 +51,7 @@ struct KickerDataImpl final if (s->GetSerializableType()->GetName() != CHANNELINFO_TYPE) return; - const ChannelInfo *ci = anope_dynamic_static_cast(e); + const auto *ci = anope_dynamic_static_cast(e); auto *kd = this->Get(ci); if (kd == NULL) return; @@ -85,7 +85,7 @@ struct KickerDataImpl final if (s->GetSerializableType()->GetName() != CHANNELINFO_TYPE) return; - ChannelInfo *ci = anope_dynamic_static_cast(e); + auto *ci = anope_dynamic_static_cast(e); auto *kd = ci->Require(BOTSERV_KICKER_DATA_EXT); data["kickerdata:amsgs"] >> kd->amsgs; @@ -988,7 +988,7 @@ public: void purge() { time_t keepdata = Config->GetModule(me).Get("keepdata"); - for (data_type::iterator it = data_map.begin(), it_end = data_map.end(); it != it_end;) + for (auto it = data_map.begin(), it_end = data_map.end(); it != it_end;) { const Anope::string &user = it->first; Data &bd = it->second; @@ -1038,7 +1038,7 @@ public: for (auto &[_, c] : ChannelList) { - BanData *bd = c->GetExt("bandata"); + auto *bd = c->GetExt("bandata"); if (bd != NULL) { bd->purge(); @@ -1488,7 +1488,7 @@ public: if (ud->lastline.equals_ci(realbuf) && !ud->lasttarget.empty() && !ud->lasttarget.equals_ci(ci->name)) { - for (User::ChanUserList::iterator it = u->chans.begin(); it != u->chans.end();) + for (auto it = u->chans.begin(); it != u->chans.end();) { Channel *chan = it->second->chan; ++it; diff --git a/modules/chanserv/chanserv.cpp b/modules/chanserv/chanserv.cpp index 608066143..4948389b3 100644 --- a/modules/chanserv/chanserv.cpp +++ b/modules/chanserv/chanserv.cpp @@ -357,7 +357,7 @@ public: if (!chanserv_expire || Anope::NoExpire || Anope::ReadOnly) return; - for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ) + for (auto it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ) { ChannelInfo *ci = it->second; ++it; @@ -369,7 +369,7 @@ public: if (ci->c) { time_t last_used = ci->last_used; - for (Channel::ChanUserList::const_iterator cit = ci->c->users.begin(), cit_end = ci->c->users.end(); cit != cit_end && last_used == ci->last_used; ++cit) + for (auto cit = ci->c->users.begin(), cit_end = ci->c->users.end(); cit != cit_end && last_used == ci->last_used; ++cit) ci->AccessFor(cit->second->user); expire = last_used == ci->last_used; } diff --git a/modules/chanserv/cs_access.cpp b/modules/chanserv/cs_access.cpp index c0dcc1b3c..0e4a2da39 100644 --- a/modules/chanserv/cs_access.cpp +++ b/modules/chanserv/cs_access.cpp @@ -276,7 +276,7 @@ private: ServiceReference provider("AccessProvider", "access/access"); if (!provider) return; - AccessChanAccess *access = anope_dynamic_static_cast(provider->Create()); + auto *access = anope_dynamic_static_cast(provider->Create()); access->SetMask(mask, ci); access->creator = source.GetNick(); access->level = level; @@ -960,7 +960,7 @@ public: /* Access accessprovider is the only accessprovider with the concept of negative access, * so check they don't have negative access */ - const AccessChanAccess *aca = anope_dynamic_static_cast(highest); + const auto *aca = anope_dynamic_static_cast(highest); if (aca->level < 0) return EVENT_CONTINUE; diff --git a/modules/chanserv/cs_akick.cpp b/modules/chanserv/cs_akick.cpp index dacb93310..d754764fa 100644 --- a/modules/chanserv/cs_akick.cpp +++ b/modules/chanserv/cs_akick.cpp @@ -201,7 +201,7 @@ class CommandCSAKick final return; } - for (Channel::ChanUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ) + for (auto it = c->users.begin(), it_end = c->users.end(); it != it_end; ) { auto *memb = it->second; ++it; @@ -223,7 +223,7 @@ class CommandCSAKick final const NickAlias *na = NickAlias::Find(mask); NickCore *nc = NULL; const ChanServ::AutoKick *akick; - unsigned reasonmax = Config->GetModule("chanserv").Get("reasonmax", "200"); + auto reasonmax = Config->GetModule("chanserv").Get("reasonmax", "200"); if (reason.length() > reasonmax) reason = reason.substr(0, reasonmax); diff --git a/modules/chanserv/cs_ban.cpp b/modules/chanserv/cs_ban.cpp index 518d1560a..b2af89845 100644 --- a/modules/chanserv/cs_ban.cpp +++ b/modules/chanserv/cs_ban.cpp @@ -128,7 +128,7 @@ public: reason += " " + params[3]; } - unsigned reasonmax = Config->GetModule("chanserv").Get("reasonmax", "200"); + auto reasonmax = Config->GetModule("chanserv").Get("reasonmax", "200"); if (reason.length() > reasonmax) reason = reason.substr(0, reasonmax); @@ -211,7 +211,7 @@ public: } int matched = 0, kicked = 0; - for (Channel::ChanUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end;) + for (auto it = c->users.begin(), it_end = c->users.end(); it != it_end;) { auto *memb = it->second; ++it; diff --git a/modules/chanserv/cs_clone.cpp b/modules/chanserv/cs_clone.cpp index ccde3e8b1..5d5ae9e94 100644 --- a/modules/chanserv/cs_clone.cpp +++ b/modules/chanserv/cs_clone.cpp @@ -28,7 +28,7 @@ class CommandCSClone final static void CopyAccess(CommandSource &source, ChannelInfo *ci, ChannelInfo *target_ci) { std::set masks; - unsigned access_max = Config->GetModule("chanserv").Get("accessmax", "1000"); + auto access_max = Config->GetModule("chanserv").Get("accessmax", "1000"); unsigned count = 0; for (unsigned i = 0; i < target_ci->GetAccessCount(); ++i) diff --git a/modules/chanserv/cs_enforce.cpp b/modules/chanserv/cs_enforce.cpp index baff006c5..2aec14f26 100644 --- a/modules/chanserv/cs_enforce.cpp +++ b/modules/chanserv/cs_enforce.cpp @@ -177,7 +177,7 @@ private: std::vector users; /* The newer users are at the end of the list, so kick users starting from the end */ - for (Channel::ChanUserList::reverse_iterator it = ci->c->users.rbegin(), it_end = ci->c->users.rend(); it != it_end; ++it) + for (auto it = ci->c->users.rbegin(), it_end = ci->c->users.rend(); it != it_end; ++it) { auto *memb = it->second; User *user = memb->user; diff --git a/modules/chanserv/cs_entrymsg.cpp b/modules/chanserv/cs_entrymsg.cpp index 19fd3acdc..de5b62dee 100644 --- a/modules/chanserv/cs_entrymsg.cpp +++ b/modules/chanserv/cs_entrymsg.cpp @@ -98,7 +98,7 @@ Serializable *EntryMsgTypeImpl::Unserialize(Serializable *obj, Serialize::Data & if (obj) { - EntryMsgImpl *msg = anope_dynamic_static_cast(obj); + auto *msg = anope_dynamic_static_cast(obj); msg->chan = ci->name; data["creator"] >> msg->creator; data["message"] >> msg->message; diff --git a/modules/chanserv/cs_flags.cpp b/modules/chanserv/cs_flags.cpp index 5a46b9b08..70063aa3b 100644 --- a/modules/chanserv/cs_flags.cpp +++ b/modules/chanserv/cs_flags.cpp @@ -28,7 +28,7 @@ public: bool HasPriv(const Anope::string &priv) const override { - std::map::iterator it = defaultFlags.find(priv); + auto it = defaultFlags.find(priv); return it != defaultFlags.end() && this->flags.count(it->second) > 0; } @@ -301,7 +301,7 @@ class CommandCSFlags final ServiceReference provider("AccessProvider", "access/flags"); if (!provider) return; - FlagsChanAccess *access = anope_dynamic_static_cast(provider->Create()); + auto *access = anope_dynamic_static_cast(provider->Create()); access->SetMask(mask, ci); access->creator = source.GetNick(); access->description = current ? current->description : description; diff --git a/modules/chanserv/cs_kick.cpp b/modules/chanserv/cs_kick.cpp index 1f876cb0b..316080712 100644 --- a/modules/chanserv/cs_kick.cpp +++ b/modules/chanserv/cs_kick.cpp @@ -47,7 +47,7 @@ public: return; } - unsigned reasonmax = Config->GetModule("chanserv").Get("reasonmax", "200"); + auto reasonmax = Config->GetModule("chanserv").Get("reasonmax", "200"); if (reason.length() > reasonmax) reason = reason.substr(0, reasonmax); @@ -90,7 +90,7 @@ public: Log(LOG_COMMAND, source, this, ci) << "for " << mask; int matched = 0, kicked = 0; - for (Channel::ChanUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end;) + for (auto it = c->users.begin(), it_end = c->users.end(); it != it_end;) { auto *memb = it->second; ++it; diff --git a/modules/chanserv/cs_list.cpp b/modules/chanserv/cs_list.cpp index df6c45200..838ac98bb 100644 --- a/modules/chanserv/cs_list.cpp +++ b/modules/chanserv/cs_list.cpp @@ -73,7 +73,7 @@ public: } Anope::string spattern = "#" + pattern; - unsigned listmax = Config->GetModule(this->owner).Get("listmax", "50"); + auto listmax = Config->GetModule(this->owner).Get("listmax", "50"); source.Reply(_("List of entries matching \002%s\002:"), pattern.c_str()); diff --git a/modules/chanserv/cs_mode.cpp b/modules/chanserv/cs_mode.cpp index bf72b47e6..0eafa2d70 100644 --- a/modules/chanserv/cs_mode.cpp +++ b/modules/chanserv/cs_mode.cpp @@ -601,7 +601,7 @@ class CommandCSMode final } } - for (Channel::ChanUserList::const_iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end;) + for (auto it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end;) { auto *memb = it->second; ++it; @@ -1102,7 +1102,7 @@ public: Anope::string param; if (cm->type == MODE_PARAM) { - ChannelModeParam *cmp = anope_dynamic_static_cast(cm); + auto *cmp = anope_dynamic_static_cast(cm); if (add || !cmp->minus_no_arg) { sep.GetToken(param); diff --git a/modules/chanserv/cs_register.cpp b/modules/chanserv/cs_register.cpp index 89f44a322..797197b02 100644 --- a/modules/chanserv/cs_register.cpp +++ b/modules/chanserv/cs_register.cpp @@ -28,7 +28,7 @@ public: { const Anope::string &chan = params[0]; const Anope::string &chdesc = params.size() > 1 ? params[1] : ""; - unsigned maxregistered = Config->GetModule("chanserv").Get("maxregistered"); + auto maxregistered = Config->GetModule("chanserv").Get("maxregistered"); User *u = source.GetUser(); NickCore *nc = source.nc; diff --git a/modules/chanserv/cs_seen.cpp b/modules/chanserv/cs_seen.cpp index 447ca4ec9..dfa858281 100644 --- a/modules/chanserv/cs_seen.cpp +++ b/modules/chanserv/cs_seen.cpp @@ -41,7 +41,7 @@ struct SeenInfo final ~SeenInfo() override { - database_map::iterator iter = database.find(nick); + auto iter = database.find(nick); if (iter != database.end() && iter->second == this) database.erase(iter); } @@ -144,7 +144,7 @@ struct SeenInfoType final static SeenInfo *FindInfo(const Anope::string &nick) { - database_map::iterator iter = database.find(nick); + auto iter = database.find(nick); if (iter != database.end()) return iter->second; return NULL; @@ -203,7 +203,7 @@ public: time = Anope::CurTime - time; database_map::iterator buf; size_t counter = 0; - for (database_map::iterator it = database.begin(), it_end = database.end(); it != it_end;) + for (auto it = database.begin(), it_end = database.end(); it != it_end;) { buf = it; ++it; @@ -379,9 +379,9 @@ public: return; auto previous_size = database.size(); - for (database_map::iterator it = database.begin(), it_end = database.end(); it != it_end;) + for (auto it = database.begin(), it_end = database.end(); it != it_end;) { - database_map::iterator cur = it; + auto cur = it; ++it; if ((Anope::CurTime - cur->second->last) > purgetime) diff --git a/modules/chanserv/cs_set.cpp b/modules/chanserv/cs_set.cpp index 12d125700..63d84c85c 100644 --- a/modules/chanserv/cs_set.cpp +++ b/modules/chanserv/cs_set.cpp @@ -320,7 +320,7 @@ public: } NickCore *nc = na->nc; - unsigned max_reg = Config->GetModule("chanserv").Get("maxregistered"); + auto max_reg = Config->GetModule("chanserv").Get("maxregistered"); if (max_reg && nc->channelcount >= max_reg && !source.HasPriv("chanserv/no-register-limit")) { source.Reply(_("\002%s\002 has too many channels registered."), na->nick.c_str()); @@ -1018,7 +1018,7 @@ public: "channel will be dropped." )); - unsigned max_reg = Config->GetModule("chanserv").Get("maxregistered"); + auto max_reg = Config->GetModule("chanserv").Get("maxregistered"); if (max_reg) { source.Reply(" "); @@ -1112,7 +1112,7 @@ class CSSet final if (s->GetSerializableType()->GetName() != CHANNELINFO_TYPE) return; - const ChannelInfo *ci = anope_dynamic_static_cast(s); + const auto *ci = anope_dynamic_static_cast(s); Anope::string modes; for (const auto &[last_mode, last_data] : ci->last_modes) { @@ -1138,7 +1138,7 @@ class CSSet final if (s->GetSerializableType()->GetName() != CHANNELINFO_TYPE) return; - ChannelInfo *ci = anope_dynamic_static_cast(s); + auto *ci = anope_dynamic_static_cast(s); Anope::string modes; data["last_modes"] >> modes; ci->last_modes.clear(); diff --git a/modules/chanserv/cs_suspend.cpp b/modules/chanserv/cs_suspend.cpp index fd0c0a29b..81b086feb 100644 --- a/modules/chanserv/cs_suspend.cpp +++ b/modules/chanserv/cs_suspend.cpp @@ -116,7 +116,7 @@ public: for (auto idx = reason_idx; idx < params.size(); ++idx) reason.append(reason.empty() ? "" : " ").append(params[idx]); - CSSuspendInfo *si = ci->Extend("CS_SUSPENDED"); + auto *si = ci->Extend("CS_SUSPENDED"); si->what = ci->name; si->by = source.GetNick(); si->reason = reason; @@ -186,7 +186,7 @@ public: } /* Only UNSUSPEND already suspended channels */ - CSSuspendInfo *si = ci->GetExt("CS_SUSPENDED"); + auto *si = ci->GetExt("CS_SUSPENDED"); if (!si) { source.Reply(_("Channel \002%s\002 isn't suspended."), ci->name.c_str()); @@ -254,7 +254,7 @@ public: void OnReload(Configuration::Conf &conf) override { - Anope::string s = conf.GetModule(this).Get("show"); + auto s = conf.GetModule(this).Get("show"); commasepstream(s).GetTokens(show); std::transform(show.begin(), show.end(), show.begin(), trim()); } diff --git a/modules/chanserv/cs_updown.cpp b/modules/chanserv/cs_updown.cpp index 31f599bad..e5c08b83a 100644 --- a/modules/chanserv/cs_updown.cpp +++ b/modules/chanserv/cs_updown.cpp @@ -58,7 +58,7 @@ public: { if (!source.GetUser()) return; - for (User::ChanUserList::iterator it = source.GetUser()->chans.begin(); it != source.GetUser()->chans.end(); ++it) + for (auto it = source.GetUser()->chans.begin(); it != source.GetUser()->chans.end(); ++it) { Channel *c = it->second->chan; SetModes(source.GetUser(), c); @@ -162,7 +162,7 @@ public: { if (!source.GetUser()) return; - for (User::ChanUserList::iterator it = source.GetUser()->chans.begin(); it != source.GetUser()->chans.end(); ++it) + for (auto it = source.GetUser()->chans.begin(); it != source.GetUser()->chans.end(); ++it) { Channel *c = it->second->chan; RemoveAll(source.GetUser(), c); diff --git a/modules/chanserv/cs_xop.cpp b/modules/chanserv/cs_xop.cpp index f9de8c375..760aa8308 100644 --- a/modules/chanserv/cs_xop.cpp +++ b/modules/chanserv/cs_xop.cpp @@ -32,7 +32,7 @@ public: bool HasPriv(const Anope::string &priv) const override { - for (std::vector::iterator it = std::find(order.begin(), order.end(), this->type); it != order.end(); ++it) + for (auto it = std::find(order.begin(), order.end(), this->type); it != order.end(); ++it) { const std::vector &privs = permissions[*it]; if (std::find(privs.begin(), privs.end(), priv) != privs.end()) @@ -55,7 +55,7 @@ public: { if (access->provider->name == "access/xop") { - const XOPChanAccess *xaccess = anope_dynamic_static_cast(access); + const auto *xaccess = anope_dynamic_static_cast(access); return xaccess->type; } else @@ -128,7 +128,7 @@ private: bool override = false; const NickAlias *na = NULL; - std::vector::iterator cmd_it = std::find(order.begin(), order.end(), source.command.upper()), + auto cmd_it = std::find(order.begin(), order.end(), source.command.upper()), access_it = highest ? std::find(order.begin(), order.end(), XOPChanAccess::DetermineLevel(highest)) : order.end(); if (!access.founder && (!access.HasPriv("ACCESS_CHANGE") || cmd_it <= access_it)) @@ -252,7 +252,7 @@ private: ServiceReference provider("AccessProvider", "access/xop"); if (!provider) return; - XOPChanAccess *acc = anope_dynamic_static_cast(provider->Create()); + auto *acc = anope_dynamic_static_cast(provider->Create()); acc->SetMask(mask, ci); acc->creator = source.GetNick(); acc->description = description; @@ -311,7 +311,7 @@ private: } } - std::vector::iterator cmd_it = std::find(order.begin(), order.end(), source.command.upper()), + auto cmd_it = std::find(order.begin(), order.end(), source.command.upper()), access_it = highest ? std::find(order.begin(), order.end(), XOPChanAccess::DetermineLevel(highest)) : order.end(); if (!mask.equals_ci(nc->display) && !access.founder && (!access.HasPriv("ACCESS_CHANGE") || cmd_it <= access_it)) diff --git a/modules/chanstats.cpp b/modules/chanstats.cpp index 563fea722..d8ef74d24 100644 --- a/modules/chanstats.cpp +++ b/modules/chanstats.cpp @@ -235,7 +235,7 @@ class MChanstats final for (int i = 0; i < r.Rows(); ++i) { const std::map &map = r.Row(i); - for (std::map::const_iterator it = map.begin(); it != map.end(); ++it) + for (auto it = map.begin(); it != map.end(); ++it) TableList.push_back(it->second); } query = "SHOW PROCEDURE STATUS WHERE `Db` = Database();"; @@ -254,7 +254,7 @@ class MChanstats final bool HasTable(const Anope::string &table) { - for (std::vector::const_iterator it = TableList.begin(); it != TableList.end(); ++it) + for (auto it = TableList.begin(); it != TableList.end(); ++it) if (*it == table) return true; return false; @@ -262,7 +262,7 @@ class MChanstats final bool HasProcedure(const Anope::string &table) { - for (std::vector::const_iterator it = ProcedureList.begin(); it != ProcedureList.end(); ++it) + for (auto it = ProcedureList.begin(); it != ProcedureList.end(); ++it) if (*it == table) return true; return false; @@ -270,7 +270,7 @@ class MChanstats final bool HasEvent(const Anope::string &table) { - for (std::vector::const_iterator it = EventList.begin(); it != EventList.end(); ++it) + for (auto it = EventList.begin(); it != EventList.end(); ++it) if (*it == table) return true; return false; diff --git a/modules/dns.cpp b/modules/dns.cpp index 7b1277f59..5149a5940 100644 --- a/modules/dns.cpp +++ b/modules/dns.cpp @@ -729,7 +729,7 @@ public: delete udpsock; delete tcpsock; - for (std::map::iterator it = this->requests.begin(), it_end = this->requests.end(); it != it_end;) + for (auto it = this->requests.begin(), it_end = this->requests.end(); it != it_end;) { Request *request = it->second; ++it; @@ -909,7 +909,7 @@ public: return true; } - std::map::iterator it = this->requests.find(recv_packet.id); + auto it = this->requests.find(recv_packet.id); if (it == this->requests.end()) { Log(LOG_DEBUG_2) << "Resolver: Received an answer for something we didn't request"; @@ -1043,7 +1043,7 @@ private: */ bool CheckCache(Request *request) { - cache_map::iterator it = this->cache.find(*request); + auto it = this->cache.find(*request); if (it != this->cache.end()) { Query &record = it->second; @@ -1070,7 +1070,7 @@ public: ~ModuleDNS() override { - for (std::map::const_iterator it = SocketEngine::Sockets.begin(), it_end = SocketEngine::Sockets.end(); it != it_end;) + for (auto it = SocketEngine::Sockets.begin(), it_end = SocketEngine::Sockets.end(); it != it_end;) { Socket *s = it->second; ++it; @@ -1096,8 +1096,8 @@ public: for (int i = 0; i < block.CountBlock("notify"); ++i) { const auto &n = block.GetBlock("notify", i); - Anope::string nip = n.Get("ip"); - short nport = n.Get("port"); + auto nip = n.Get("ip"); + auto nport = n.Get("port"); notify.emplace_back(nip, nport); } @@ -1149,7 +1149,7 @@ public: void OnModuleUnload(User *u, Module *m) override { - for (std::map::iterator it = this->manager.requests.begin(), it_end = this->manager.requests.end(); it != it_end;) + for (auto it = this->manager.requests.begin(), it_end = this->manager.requests.end(); it != it_end;) { unsigned short id = it->first; Request *req = it->second; diff --git a/modules/fantasy.cpp b/modules/fantasy.cpp index b7affdc3b..6691fa5bc 100644 --- a/modules/fantasy.cpp +++ b/modules/fantasy.cpp @@ -147,7 +147,7 @@ public: if (params.empty()) return; - CommandInfo::map::const_iterator it = Config->Fantasy.end(); + auto it = Config->Fantasy.end(); unsigned count = 0; for (unsigned max = params.size(); it == Config->Fantasy.end() && max > 0; --max) { diff --git a/modules/help.cpp b/modules/help.cpp index dddb483fc..f3da8fa1f 100644 --- a/modules/help.cpp +++ b/modules/help.cpp @@ -138,7 +138,7 @@ public: full_command += " " + params[i]; full_command.erase(full_command.begin()); - CommandInfo::map::const_iterator it = map.find(full_command); + auto it = map.find(full_command); if (it == map.end()) continue; diff --git a/modules/httpd.cpp b/modules/httpd.cpp index ab29734d1..098613db2 100644 --- a/modules/httpd.cpp +++ b/modules/httpd.cpp @@ -354,7 +354,7 @@ public: ~HTTPD() override { - for (std::map::const_iterator it = SocketEngine::Sockets.begin(), it_end = SocketEngine::Sockets.end(); it != it_end;) + for (auto it = SocketEngine::Sockets.begin(), it_end = SocketEngine::Sockets.end(); it != it_end;) { Socket *s = it->second; ++it; @@ -447,7 +447,7 @@ public: spacesepstream(ext_header).GetTokens(p->ext_headers); } - for (std::map::iterator it = this->providers.begin(), it_end = this->providers.end(); it != it_end;) + for (auto it = this->providers.begin(), it_end = this->providers.end(); it != it_end;) { HTTP::Provider *p = it->second; ++it; diff --git a/modules/nickserv/nickserv.cpp b/modules/nickserv/nickserv.cpp index 119dd3cc5..e87d058f4 100644 --- a/modules/nickserv/nickserv.cpp +++ b/modules/nickserv/nickserv.cpp @@ -115,7 +115,7 @@ public: , nick(na->nick) { /* Erase the current release timer and use the new one */ - Anope::map::iterator nit = NickServReleases.find(this->nick); + auto nit = NickServReleases.find(this->nick); if (nit != NickServReleases.end()) { IRCD->SendQuit(nit->second); @@ -379,7 +379,7 @@ public: Log(NickServ, "nick") << "Deleting account " << nc->display; /* Clean up this nick core from any users online */ - for (std::list::iterator it = nc->users.begin(); it != nc->users.end();) + for (auto it = nc->users.begin(); it != nc->users.end();) { User *user = *it++; IRCD->SendLogout(user); @@ -610,7 +610,7 @@ public: time_t nickserv_expire = Config->GetModule(this).Get("expire", "1y"); - for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; ) + for (auto it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; ) { NickAlias *na = it->second; ++it; diff --git a/modules/nickserv/ns_ajoin.cpp b/modules/nickserv/ns_ajoin.cpp index 81b523f02..996831bca 100644 --- a/modules/nickserv/ns_ajoin.cpp +++ b/modules/nickserv/ns_ajoin.cpp @@ -34,10 +34,10 @@ struct AJoinEntry final ~AJoinEntry() override { - AJoinList *channels = owner->GetExt("ajoinlist"); + auto *channels = owner->GetExt("ajoinlist"); if (channels) { - std::vector::iterator it = std::find((*channels)->begin(), (*channels)->end(), this); + auto it = std::find((*channels)->begin(), (*channels)->end(), this); if (it != (*channels)->end()) (*channels)->erase(it); } @@ -89,7 +89,7 @@ struct AJoinEntryType final if (!obj) { - AJoinList *channels = nc->Require("ajoinlist"); + auto *channels = nc->Require("ajoinlist"); (*channels)->push_back(aj); } @@ -108,7 +108,7 @@ class CommandNSAJoin final { static void DoList(CommandSource &source, NickCore *nc) { - AJoinList *channels = nc->Require("ajoinlist"); + auto *channels = nc->Require("ajoinlist"); if ((*channels)->empty()) source.Reply(_("%s's auto join list is empty."), nc->display.c_str()); @@ -141,7 +141,7 @@ class CommandNSAJoin final void DoAdd(CommandSource &source, NickCore *nc, const Anope::string &chans, const Anope::string &keys) { const auto ajoinmax = Config->GetModule(this->owner).Get("ajoinmax"); - AJoinList *channels = nc->Require("ajoinlist"); + auto *channels = nc->Require("ajoinlist"); Anope::string addedchans; Anope::string alreadyadded; @@ -208,7 +208,7 @@ class CommandNSAJoin final void DoDel(CommandSource &source, NickCore *nc, const Anope::string &chans) { - AJoinList *channels = nc->Require("ajoinlist"); + auto *channels = nc->Require("ajoinlist"); Anope::string delchans; Anope::string notfoundchans; commasepstream sep(chans); @@ -344,7 +344,7 @@ public: if (!NickServ) return; - AJoinList *channels = u->Account()->GetExt("ajoinlist"); + auto *channels = u->Account()->GetExt("ajoinlist"); if (channels == NULL) return; diff --git a/modules/nickserv/ns_group.cpp b/modules/nickserv/ns_group.cpp index c972dcf22..3b50583a9 100644 --- a/modules/nickserv/ns_group.cpp +++ b/modules/nickserv/ns_group.cpp @@ -146,7 +146,7 @@ public: NickAlias *target, *na = NickAlias::Find(source.GetNick()); time_t reg_delay = Config->GetModule("nickserv").Get("regdelay"); - unsigned maxaliases = Config->GetModule(this->owner).Get("maxaliases"); + auto maxaliases = Config->GetModule(this->owner).Get("maxaliases"); if (!(target = NickAlias::Find(nick))) source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); else if (user && Anope::CurTime < user->lastnickreg + reg_delay) @@ -258,7 +258,7 @@ public: { NickCore *oldcore = na->nc; - std::vector::iterator it = std::find(oldcore->aliases->begin(), oldcore->aliases->end(), na); + auto it = std::find(oldcore->aliases->begin(), oldcore->aliases->end(), na); if (it != oldcore->aliases->end()) oldcore->aliases->erase(it); diff --git a/modules/nickserv/ns_identify.cpp b/modules/nickserv/ns_identify.cpp index 6595c0783..2ad2edbf0 100644 --- a/modules/nickserv/ns_identify.cpp +++ b/modules/nickserv/ns_identify.cpp @@ -91,7 +91,7 @@ public: return; } - unsigned int maxlogins = Config->GetModule(this->owner).Get("maxlogins"); + auto maxlogins = Config->GetModule(this->owner).Get("maxlogins"); if (na && maxlogins && na->nc->users.size() >= maxlogins) { source.Reply(_("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), na->nc->display.c_str(), maxlogins); diff --git a/modules/nickserv/ns_recover.cpp b/modules/nickserv/ns_recover.cpp index e5f93a547..c00089233 100644 --- a/modules/nickserv/ns_recover.cpp +++ b/modules/nickserv/ns_recover.cpp @@ -73,7 +73,7 @@ public: { if (!u->chans.empty()) { - NSRecoverInfo *ei = source.GetUser()->Extend("recover"); + auto *ei = source.GetUser()->Extend("recover"); for (auto &[chan, cuc] : u->chans) (*ei)[chan->name] = cuc->status; } @@ -108,7 +108,7 @@ public: if (IRCD->CanSVSNick) { - NSRecoverSvsnick *svs = u->Extend("svsnick"); + auto *svs = u->Extend("svsnick"); svs->from = source.GetUser(); svs->to = u->nick; } @@ -253,7 +253,7 @@ public: BotInfo *NickServ = Config->GetClient("NickServ"); if (ei != NULL && NickServ != NULL) - for (NSRecoverInfo::iterator it = ei->begin(), it_end = ei->end(); it != it_end;) + for (auto it = ei->begin(), it_end = ei->end(); it != it_end;) { Channel *c = Channel::Find(it->first); const Anope::string &cname = it->first; @@ -288,7 +288,7 @@ public: if (ei != NULL) { - NSRecoverInfo::iterator it = ei->find(c->name); + auto it = ei->find(c->name); if (it != ei->end()) { for (auto mode : it->second.Modes()) diff --git a/modules/nickserv/ns_register.cpp b/modules/nickserv/ns_register.cpp index 510b55095..1bc992895 100644 --- a/modules/nickserv/ns_register.cpp +++ b/modules/nickserv/ns_register.cpp @@ -181,7 +181,7 @@ public: bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - unsigned int minpasslen = Config->GetModule("nickserv").Get("minpasslen", "10"); + auto minpasslen = Config->GetModule("nickserv").Get("minpasslen", "10"); this->SendSyntax(source); source.Reply(" "); source.Reply(_( diff --git a/modules/nickserv/ns_sasl.cpp b/modules/nickserv/ns_sasl.cpp index 315758fd5..00dc41ec0 100644 --- a/modules/nickserv/ns_sasl.cpp +++ b/modules/nickserv/ns_sasl.cpp @@ -115,7 +115,7 @@ public: Anope::string GetAgent() { - Anope::string agent = Config->GetModule(Service::owner).Get("agent", "NickServ"); + auto agent = Config->GetModule(Service::owner).Get("agent", "NickServ"); BotInfo *bi = Config->GetClient(agent); if (bi) agent = bi->GetUID(); diff --git a/modules/nickserv/ns_sasl_external.cpp b/modules/nickserv/ns_sasl_external.cpp index ef7318d9b..aa8697f4a 100644 --- a/modules/nickserv/ns_sasl_external.cpp +++ b/modules/nickserv/ns_sasl_external.cpp @@ -44,7 +44,7 @@ public: bool ProcessMessage(SASL::Session *sess, const SASL::Message &m) override { - Session *mysess = anope_dynamic_static_cast(sess); + auto *mysess = anope_dynamic_static_cast(sess); if (m.type == "S") { diff --git a/modules/nickserv/ns_set_keepmodes.cpp b/modules/nickserv/ns_set_keepmodes.cpp index 7b2b9c366..7cb7365de 100644 --- a/modules/nickserv/ns_set_keepmodes.cpp +++ b/modules/nickserv/ns_set_keepmodes.cpp @@ -129,7 +129,7 @@ private: if (s->GetSerializableType()->GetName() != NICKCORE_TYPE) return; - const NickCore *nc = anope_dynamic_static_cast(s); + const auto *nc = anope_dynamic_static_cast(s); Anope::string modes; for (const auto &[last_mode, last_data] : nc->last_modes) { @@ -155,7 +155,7 @@ private: if (s->GetSerializableType()->GetName() != NICKCORE_TYPE) return; - NickCore *nc = anope_dynamic_static_cast(s); + auto *nc = anope_dynamic_static_cast(s); Anope::string modes; data["last_modes"] >> modes; nc->last_modes.clear(); diff --git a/modules/nickserv/ns_suspend.cpp b/modules/nickserv/ns_suspend.cpp index 6560b31f1..0ce02130c 100644 --- a/modules/nickserv/ns_suspend.cpp +++ b/modules/nickserv/ns_suspend.cpp @@ -124,7 +124,7 @@ public: for (auto idx = reason_idx; idx < params.size(); ++idx) reason.append(reason.empty() ? "" : " ").append(params[idx]); - NSSuspendInfo *si = nc->Extend("NS_SUSPENDED"); + auto *si = nc->Extend("NS_SUSPENDED"); si->what = nc->display; si->by = source.GetNick(); si->reason = reason; @@ -199,7 +199,7 @@ public: return; } - NSSuspendInfo *si = na->nc->GetExt("NS_SUSPENDED"); + auto *si = na->nc->GetExt("NS_SUSPENDED"); Log(LOG_ADMIN, source, this) << "for " << na->nick << " which was suspended by " << (!si->by.empty() ? si->by : "(none)") << " for: " << (!si->reason.empty() ? si->reason : "No reason"); @@ -258,7 +258,7 @@ public: void OnReload(Configuration::Conf &conf) override { - Anope::string s = conf.GetModule(this).Get("show"); + auto s = conf.GetModule(this).Get("show"); commasepstream(s).GetTokens(show); std::transform(show.begin(), show.end(), show.begin(), trim()); } diff --git a/modules/operserv/os_defcon.cpp b/modules/operserv/os_defcon.cpp index ed396f291..dd15ecaaf 100644 --- a/modules/operserv/os_defcon.cpp +++ b/modules/operserv/os_defcon.cpp @@ -86,7 +86,7 @@ struct DefconConfig final bool GetDefConParam(const Anope::string &name, Anope::string &buf) { - std::map::iterator it = DefConModesOnParams.find(name); + auto it = DefConModesOnParams.find(name); buf.clear(); diff --git a/modules/operserv/os_dns.cpp b/modules/operserv/os_dns.cpp index c95e52a4b..bd08c75e4 100644 --- a/modules/operserv/os_dns.cpp +++ b/modules/operserv/os_dns.cpp @@ -38,7 +38,7 @@ struct DNSZone final ~DNSZone() override { - std::vector::iterator it = std::find(zones->begin(), zones->end(), this); + auto it = std::find(zones->begin(), zones->end(), this); if (it != zones->end()) zones->erase(it); } @@ -127,7 +127,7 @@ public: ~DNSServer() override { - std::vector::iterator it = std::find(dns_servers->begin(), dns_servers->end(), this); + auto it = std::find(dns_servers->begin(), dns_servers->end(), this); if (it != dns_servers->end()) dns_servers->erase(it); } diff --git a/modules/operserv/os_forbid.cpp b/modules/operserv/os_forbid.cpp index 1d17452e2..fb4e39987 100644 --- a/modules/operserv/os_forbid.cpp +++ b/modules/operserv/os_forbid.cpp @@ -325,7 +325,7 @@ public: for (const auto &[_, user] : UserListByNick) module->OnUserNickChange(user, ""); - for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end;) + for (auto it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end;) { NickAlias *na = it->second; ++it; @@ -346,7 +346,7 @@ public: { int chan_matches = 0, ci_matches = 0; - for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end;) + for (auto it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end;) { Channel *c = it->second; ++it; @@ -369,7 +369,7 @@ public: ++chan_matches; - for (Channel::ChanUserList::const_iterator cit = c->users.begin(), cit_end = c->users.end(); cit != cit_end;) + for (auto cit = c->users.begin(), cit_end = c->users.end(); cit != cit_end;) { User *u = cit->first; ++cit; @@ -383,7 +383,7 @@ public: } } - for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(); it != RegisteredChannelList->end();) + for (auto it = RegisteredChannelList->begin(); it != RegisteredChannelList->end();) { ChannelInfo *ci = it->second; ++it; diff --git a/modules/operserv/os_info.cpp b/modules/operserv/os_info.cpp index 87cebfced..20e3247ee 100644 --- a/modules/operserv/os_info.cpp +++ b/modules/operserv/os_info.cpp @@ -77,10 +77,10 @@ OperInfoImpl::~OperInfoImpl() Extensible *e = OperInfos::Find(target); if (e) { - OperInfos *op = e->GetExt("operinfo"); + auto *op = e->GetExt("operinfo"); if (op) { - std::vector::iterator it = std::find((*op)->begin(), (*op)->end(), this); + auto it = std::find((*op)->begin(), (*op)->end(), this); if (it != (*op)->end()) (*op)->erase(it); } @@ -96,7 +96,7 @@ Serializable *OperInfoTypeImpl::Unserialize(Serializable *obj, Serialize::Data & if (!e) return NULL; - OperInfos *oi = e->Require("operinfo"); + auto *oi = e->Require("operinfo"); OperInfoImpl *o; if (obj) o = anope_dynamic_static_cast(obj); @@ -162,7 +162,7 @@ public: return; } - OperInfos *oi = e->Require("operinfo"); + auto *oi = e->Require("operinfo"); if ((*oi)->size() >= Config->GetModule(this->module).Get("max", "10")) { @@ -195,7 +195,7 @@ public: return; } - OperInfos *oi = e->GetExt("operinfo"); + auto *oi = e->GetExt("operinfo"); if (!oi) { @@ -234,7 +234,7 @@ public: } else if (cmd.equals_ci("CLEAR")) { - OperInfos *oi = e->GetExt("operinfo"); + auto *oi = e->GetExt("operinfo"); if (!oi) { diff --git a/modules/operserv/os_list.cpp b/modules/operserv/os_list.cpp index 2bd07b27a..59eb3491c 100644 --- a/modules/operserv/os_list.cpp +++ b/modules/operserv/os_list.cpp @@ -202,7 +202,7 @@ public: source.Reply(_("Users list:")); - for (Anope::map::const_iterator it = ordered_map.begin(); it != ordered_map.end(); ++it) + for (auto it = ordered_map.begin(); it != ordered_map.end(); ++it) { User *u2 = it->second; diff --git a/modules/operserv/os_news.cpp b/modules/operserv/os_news.cpp index db47cf827..e19c8a6f2 100644 --- a/modules/operserv/os_news.cpp +++ b/modules/operserv/os_news.cpp @@ -265,7 +265,7 @@ protected: source.Reply(READ_ONLY_MODE); if (!text.equals_ci("ALL")) { - unsigned num = Anope::Convert(text, 0); + auto num = Anope::Convert(text, 0); if (num > 0 && num <= list.size()) { OperServ::news_service->DelNewsItem(list[num - 1]); diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp index b84ffb9e0..6ebbe1759 100644 --- a/modules/protocol/inspircd.cpp +++ b/modules/protocol/inspircd.cpp @@ -205,7 +205,7 @@ public: ListLimits *limits = maxlist.Get(c); if (limits) { - ListLimits::const_iterator limit = limits->find(cm->mchar); + auto limit = limits->find(cm->mchar); if (limit != limits->end()) return limit->second; } @@ -2416,7 +2416,7 @@ struct IRCDMessageUID final NickAlias *na = NULL; if (SASL::service) - for (std::list::iterator it = saslusers.begin(); it != saslusers.end();) + for (auto it = saslusers.begin(); it != saslusers.end();) { SASLUser &u = *it; diff --git a/modules/protocol/unrealircd.cpp b/modules/protocol/unrealircd.cpp index e9f83f697..ef80bbc4d 100644 --- a/modules/protocol/unrealircd.cpp +++ b/modules/protocol/unrealircd.cpp @@ -640,7 +640,7 @@ namespace UnrealExtBan bool Matches(User *u, const Entry *e) override { - ModData *moddata = u->GetExt("ClientModData"); + auto *moddata = u->GetExt("ClientModData"); return moddata != NULL && moddata->find("operclass") != moddata->end() && Anope::Match((*moddata)["operclass"], e->GetMask()); } }; @@ -674,7 +674,7 @@ namespace UnrealExtBan bool Matches(User *u, const Entry *e) override { - ModData *moddata = u->GetExt("ClientModData"); + auto *moddata = u->GetExt("ClientModData"); if (moddata == NULL || moddata->find("geoip") == moddata->end()) return false; diff --git a/modules/proxyscan.cpp b/modules/proxyscan.cpp index e06b7cf85..23bf62adf 100644 --- a/modules/proxyscan.cpp +++ b/modules/proxyscan.cpp @@ -224,7 +224,7 @@ class ModuleProxyScan final void Tick() override { - for (std::set::iterator it = ProxyConnect::proxies.begin(), it_end = ProxyConnect::proxies.end(); it != it_end;) + for (auto it = ProxyConnect::proxies.begin(), it_end = ProxyConnect::proxies.end(); it != it_end;) { ProxyConnect *p = *it; ++it; @@ -246,19 +246,19 @@ public: ~ModuleProxyScan() override { - for (std::set::iterator it = ProxyConnect::proxies.begin(), it_end = ProxyConnect::proxies.end(); it != it_end;) + for (auto it = ProxyConnect::proxies.begin(), it_end = ProxyConnect::proxies.end(); it != it_end;) { ProxyConnect *p = *it; ++it; delete p; } - for (std::map::const_iterator it = SocketEngine::Sockets.begin(), it_end = SocketEngine::Sockets.end(); it != it_end;) + for (auto it = SocketEngine::Sockets.begin(), it_end = SocketEngine::Sockets.end(); it != it_end;) { Socket *s = it->second; ++it; - ClientSocket *cs = dynamic_cast(s); + auto *cs = dynamic_cast(s); if (cs != NULL && cs->ls == this->listener) delete s; } diff --git a/modules/redis.cpp b/modules/redis.cpp index da81184ef..fe541dc47 100644 --- a/modules/redis.cpp +++ b/modules/redis.cpp @@ -473,7 +473,7 @@ bool RedisSocket::Read(const char *buffer, size_t l) * __keyevent@0__:set * key */ - std::map::iterator it = this->subinterfaces.find(r.multi_bulk[1]->bulk); + auto it = this->subinterfaces.find(r.multi_bulk[1]->bulk); if (it != this->subinterfaces.end()) it->second->OnResult(r); } @@ -553,14 +553,14 @@ public: const Anope::string &n = redis.Get("name"), &ip = redis.Get("ip"); int port = redis.Get("port"); - unsigned db = redis.Get("db"); + auto db = redis.Get("db"); delete services[n]; services[n] = new MyRedisService(this, n, ip, port, db); new_services.push_back(n); } - for (std::map::iterator it = services.begin(); it != services.end();) + for (auto it = services.begin(); it != services.end();) { Provider *p = it->second; ++it; diff --git a/modules/webcpanel/pages/index.cpp b/modules/webcpanel/pages/index.cpp index f1fd57ef1..caf715a66 100644 --- a/modules/webcpanel/pages/index.cpp +++ b/modules/webcpanel/pages/index.cpp @@ -48,7 +48,7 @@ public: } // Rate limit logins to 1/sec - time_t *last_login = na->nc->GetExt("webcpanel_last_login"); + auto *last_login = na->nc->GetExt("webcpanel_last_login"); if (last_login != NULL && Anope::CurTime == *last_login) { this->OnFail(); @@ -113,7 +113,7 @@ bool WebCPanel::Index::OnRequest(HTTP::Provider *server, const Anope::string &pa // Rate limit check. Anope::string ip = client->clientaddr.addr(); - Anope::unordered_map::iterator it = last_login_attempt.find(ip); + auto it = last_login_attempt.find(ip); if (it != last_login_attempt.end()) { time_t last_time = it->second; diff --git a/modules/webcpanel/pages/nickserv/info.cpp b/modules/webcpanel/pages/nickserv/info.cpp index 76dc2da84..8cb21602c 100644 --- a/modules/webcpanel/pages/nickserv/info.cpp +++ b/modules/webcpanel/pages/nickserv/info.cpp @@ -37,7 +37,7 @@ bool WebCPanel::NickServ::Info::OnRequest(HTTP::Provider *server, const Anope::s } if (message.post_data.count("greet") > 0) { - Anope::string *greet = na->nc->GetExt("greet"); + auto *greet = na->nc->GetExt("greet"); const Anope::string &post_greet = HTTP::URLDecode(message.post_data["greet"].replace_all_cs("+", " ")); if (post_greet.empty()) @@ -130,7 +130,7 @@ bool WebCPanel::NickServ::Info::OnRequest(HTTP::Provider *server, const Anope::s replacements["REGISTERED"] = Anope::strftime(na->nc->registered, na->nc); if (na->HasVHost()) replacements["VHOST"] = na->GetVHostMask(); - Anope::string *greet = na->nc->GetExt("greet"); + auto *greet = na->nc->GetExt("greet"); if (greet) replacements["GREET"] = *greet; if (na->nc->HasExt("AUTOOP")) diff --git a/modules/webcpanel/template_fileserver.cpp b/modules/webcpanel/template_fileserver.cpp index 89561d727..26c5ceb07 100644 --- a/modules/webcpanel/template_fileserver.cpp +++ b/modules/webcpanel/template_fileserver.cpp @@ -83,7 +83,7 @@ static Anope::string FindReplacement(const TemplateFileServer::Replacements &r, } } - TemplateFileServer::Replacements::const_iterator it = r.find(key); + auto it = r.find(key); if (it != r.end()) return it->second; return ""; diff --git a/src/access.cpp b/src/access.cpp index 623876ac7..93811f8a7 100644 --- a/src/access.cpp +++ b/src/access.cpp @@ -46,7 +46,7 @@ void PrivilegeManager::AddPrivilege(Privilege p) void PrivilegeManager::RemovePrivilege(Privilege &p) { - std::vector::iterator it = std::find(Privileges.begin(), Privileges.end(), p); + auto it = std::find(Privileges.begin(), Privileges.end(), p); if (it != Privileges.end()) Privileges.erase(it); @@ -82,7 +82,7 @@ AccessProvider::AccessProvider(Module *o, const Anope::string &n) : Service(o, " AccessProvider::~AccessProvider() { - std::list::iterator it = std::find(Providers.begin(), Providers.end(), this); + auto it = std::find(Providers.begin(), Providers.end(), this); if (it != Providers.end()) Providers.erase(it); } @@ -104,7 +104,7 @@ ChanAccess::~ChanAccess() { if (this->ci) { - std::vector::iterator it = std::find(this->ci->access->begin(), this->ci->access->end(), this); + auto it = std::find(this->ci->access->begin(), this->ci->access->end(), this); if (it != this->ci->access->end()) this->ci->access->erase(it); diff --git a/src/account.cpp b/src/account.cpp index 5308e406b..93e6a807b 100644 --- a/src/account.cpp +++ b/src/account.cpp @@ -74,7 +74,7 @@ void IdentifyRequest::Dispatch() void IdentifyRequest::ModuleUnload(Module *m) { - for (std::set::iterator it = Requests.begin(), it_end = Requests.end(); it != it_end;) + for (auto it = Requests.begin(), it_end = Requests.end(); it != it_end;) { IdentifyRequest *ir = *it; ++it; diff --git a/src/bots.cpp b/src/bots.cpp index c0dc55b0c..9d6415b07 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -111,7 +111,7 @@ BotInfo::~BotInfo() IRCD->SendSQLineDel(&x); } - for (std::set::iterator it = this->channels->begin(), it_end = this->channels->end(); it != it_end;) + for (auto it = this->channels->begin(), it_end = this->channels->end(); it != it_end;) { ChannelInfo *ci = *it++; this->UnAssign(NULL, ci); @@ -303,7 +303,7 @@ CommandInfo &BotInfo::SetCommand(const Anope::string &cname, const Anope::string CommandInfo *BotInfo::GetCommand(const Anope::string &cname) { - CommandInfo::map::iterator it = this->commands.find(cname); + auto it = this->commands.find(cname); if (it != this->commands.end()) return &it->second; return NULL; @@ -345,7 +345,7 @@ BotInfo *BotInfo::Find(const Anope::string &nick, bool nick_only) { if (!nick_only && IRCD != NULL && IRCD->RequiresID) { - botinfo_map::iterator it = BotListByUID->find(nick); + auto it = BotListByUID->find(nick); if (it != BotListByUID->end()) { BotInfo *bi = it->second; @@ -357,7 +357,7 @@ BotInfo *BotInfo::Find(const Anope::string &nick, bool nick_only) return NULL; } - botinfo_map::iterator it = BotListByNick->find(nick); + auto it = BotListByNick->find(nick); if (it != BotListByNick->end()) { BotInfo *bi = it->second; diff --git a/src/channels.cpp b/src/channels.cpp index 1bdd1dae9..4ccad7710 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -169,7 +169,7 @@ void Channel::DeleteUser(User *user) Membership *Channel::FindUser(User *u) const { - ChanUserList::const_iterator it = this->users.find(u); + auto it = this->users.find(u); if (it != this->users.end()) return it->second; return NULL; @@ -308,7 +308,7 @@ void Channel::SetModeInternal(MessageSource &setter, ChannelMode *ocm, const Mod if (cm->type == MODE_LIST) { - ChannelModeList *cml = anope_dynamic_static_cast(cm); + auto *cml = anope_dynamic_static_cast(cm); cml->OnAdd(this, mdata.value); } @@ -366,7 +366,7 @@ void Channel::RemoveModeInternal(MessageSource &setter, ChannelMode *ocm, const if (cm->type == MODE_LIST) { - for (Channel::ModeList::iterator it = modes.lower_bound(cm->name), it_end = modes.upper_bound(cm->name); it != it_end; ++it) + for (auto it = modes.lower_bound(cm->name), it_end = modes.upper_bound(cm->name); it != it_end; ++it) if (param.equals_ci(it->second.value)) { this->modes.erase(it); @@ -378,7 +378,7 @@ void Channel::RemoveModeInternal(MessageSource &setter, ChannelMode *ocm, const if (cm->type == MODE_LIST) { - ChannelModeList *cml = anope_dynamic_static_cast(cm); + auto *cml = anope_dynamic_static_cast(cm); cml->OnDel(this, param); } @@ -416,7 +416,7 @@ void Channel::SetMode(BotInfo *bi, ChannelMode *cm, const ModeData &data, bool e return; else if (cm->type == MODE_PARAM) { - ChannelModeParam *cmp = anope_dynamic_static_cast(cm); + auto *cmp = anope_dynamic_static_cast(cm); if (!cmp->IsValid(mdata.value)) return; @@ -432,7 +432,7 @@ void Channel::SetMode(BotInfo *bi, ChannelMode *cm, const ModeData &data, bool e } else if (cm->type == MODE_LIST) { - ChannelModeList *cml = anope_dynamic_static_cast(cm); + auto *cml = anope_dynamic_static_cast(cm); if (!cml->IsValid(mdata.value)) return; @@ -494,7 +494,7 @@ void Channel::RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string &wpar if (cm->type == MODE_PARAM) { param.clear(); - ChannelModeParam *cmp = anope_dynamic_static_cast(cm); + auto *cmp = anope_dynamic_static_cast(cm); if (!cmp->minus_no_arg) this->GetParam(cmp->name, param); } @@ -676,7 +676,7 @@ void Channel::SetModesInternal(MessageSource &source, const Anope::string &modes } else if (cm->type == MODE_PARAM) { - ChannelModeParam *cmp = anope_dynamic_static_cast(cm); + auto *cmp = anope_dynamic_static_cast(cm); if (!add && cmp->minus_no_arg) { @@ -948,7 +948,7 @@ BotInfo *Channel::WhoSends() const Channel *Channel::Find(const Anope::string &name) { - channel_map::const_iterator it = ChannelList.find(name); + auto it = ChannelList.find(name); if (it != ChannelList.end()) return it->second; diff --git a/src/command.cpp b/src/command.cpp index 5e4538b57..1bec86905 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -235,7 +235,7 @@ namespace void HandleUnknownCommand(CommandSource& source, const Anope::string &message) { // Try to find a similar command. - size_t distance = Config->GetBlock("options").Get("didyoumeandifference", "4"); + auto distance = Config->GetBlock("options").Get("didyoumeandifference", "4"); Anope::string similar; auto umessage = message.upper(); for (const auto &[command, info] : source.service->commands) @@ -282,7 +282,7 @@ bool Command::Run(CommandSource &source, const Anope::string &message) std::vector params; spacesepstream(message).GetTokens(params); - CommandInfo::map::const_iterator it = source.service->commands.end(); + auto it = source.service->commands.end(); unsigned count = 0; for (unsigned max = params.size(); it == source.service->commands.end() && max > 0; --max) { diff --git a/src/config.cpp b/src/config.cpp index 9f47ee283..b00e10516 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -80,7 +80,7 @@ const Block::item_map &Block::GetItems() const template<> const Anope::string Block::Get(const Anope::string &tag, const Anope::string &def) const { - Anope::map::const_iterator it = items.find(tag); + auto it = items.find(tag); if (it != items.end()) return it->second; @@ -611,7 +611,7 @@ void Conf::Post(Conf *old) if (o->ot == NULL) { /* Oper block has lost type */ - std::vector::iterator it = std::find(old->Opers.begin(), old->Opers.end(), o); + auto it = std::find(old->Opers.begin(), old->Opers.end(), o); if (it != old->Opers.end()) old->Opers.erase(it); @@ -652,7 +652,7 @@ Block &Conf::GetModule(const Module *m) Block &Conf::GetModule(const Anope::string &mname) { - std::map::iterator it = modules.find(mname); + auto it = modules.find(mname); if (it != modules.end()) return *it->second; @@ -678,7 +678,7 @@ Block &Conf::GetModule(const Anope::string &mname) BotInfo *Conf::GetClient(const Anope::string &cname) { - Anope::map::iterator it = bots.find(cname); + auto it = bots.find(cname); if (it != bots.end()) return BotInfo::Find(!it->second.empty() ? it->second : cname, true); @@ -895,7 +895,7 @@ void Conf::LoadConf(File &file) } Block *b = block_stack.empty() ? this : block_stack.top(); - block_map::iterator it = b->blocks.emplace(wordbuffer, Configuration::Block(wordbuffer)); + auto it = b->blocks.emplace(wordbuffer, Configuration::Block(wordbuffer)); b = &it->second; b->linenum = linenumber; block_stack.push(b); diff --git a/src/extensible.cpp b/src/extensible.cpp index ab45f4070..44e72fce9 100644 --- a/src/extensible.cpp +++ b/src/extensible.cpp @@ -49,7 +49,7 @@ bool Extensible::HasExt(const Anope::string &name) const void Extensible::ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) { - for (std::set::iterator it = e->extension_items.begin(); it != e->extension_items.end(); ++it) + for (auto it = e->extension_items.begin(); it != e->extension_items.end(); ++it) { ExtensibleBase *eb = *it; eb->ExtensibleSerialize(e, s, data); diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 15f7d487f..ff36edfb8 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -26,7 +26,7 @@ static unsigned char case_map_upper[256], case_map_lower[256]; /* called whenever Anope::casemap is modified to rebuild the casemap cache */ void Anope::CaseMapRebuild() { - const std::ctype &ct = std::use_facet >(Anope::casemap); + const auto &ct = std::use_facet >(Anope::casemap); for (unsigned i = 0; i < sizeof(case_map_upper); ++i) { diff --git a/src/memos.cpp b/src/memos.cpp index 93de6a97a..3b6809613 100644 --- a/src/memos.cpp +++ b/src/memos.cpp @@ -31,7 +31,7 @@ Memo::~Memo() { if (mi) { - std::vector::iterator it = std::find(mi->memos->begin(), mi->memos->end(), this); + auto it = std::find(mi->memos->begin(), mi->memos->end(), this); if (it != mi->memos->end()) mi->memos->erase(it); @@ -115,7 +115,7 @@ void MemoInfo::Del(unsigned index) Memo *m = this->GetMemo(index); - std::vector::iterator it = std::find(memos->begin(), memos->end(), m); + auto it = std::find(memos->begin(), memos->end(), m); if (it != memos->end()) memos->erase(it); diff --git a/src/messages.cpp b/src/messages.cpp index c300e935a..17c3daa32 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -90,7 +90,7 @@ void Join::Run(MessageSource &source, const std::vector ¶ms, /* Special case for /join 0 */ if (channel == "0") { - for (User::ChanUserList::iterator it = user->chans.begin(), it_end = user->chans.end(); it != it_end; ) + for (auto it = user->chans.begin(), it_end = user->chans.end(); it != it_end; ) { auto *memb = it->second; Channel *c = memb->chan; diff --git a/src/misc.cpp b/src/misc.cpp index c5d22475d..29dc945a2 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -105,7 +105,7 @@ void NumberList::Process() if (this->desc) { - for (std::set::reverse_iterator it = numbers.rbegin(), it_end = numbers.rend(); it != it_end; ++it) + for (auto it = numbers.rbegin(), it_end = numbers.rend(); it != it_end; ++it) this->HandleNumber(*it); } else diff --git a/src/modes.cpp b/src/modes.cpp index 0004af0d3..07102ae85 100644 --- a/src/modes.cpp +++ b/src/modes.cpp @@ -206,7 +206,7 @@ ChannelModeVirtual::~ChannelModeVirtual() { if (basech) { - std::vector::iterator it = std::find(basech->listeners.begin(), basech->listeners.end(), this); + auto it = std::find(basech->listeners.begin(), basech->listeners.end(), this); if (it != basech->listeners.end()) basech->listeners.erase(it); } @@ -325,7 +325,7 @@ public: template static StackerInfo *GetInfo(List &l, Object *o) { - typename List::const_iterator it = l.find(o); + auto it = l.find(o); if (it != l.end()) return it->second; @@ -384,7 +384,7 @@ bool ModeManager::AddChannelMode(ChannelMode *cm) if (cm->type == MODE_STATUS) { - ChannelModeStatus *cms = anope_dynamic_static_cast(cm); + auto *cms = anope_dynamic_static_cast(cm); unsigned want = cms->symbol; if (want >= ChannelModesIdx.size()) ChannelModesIdx.resize(want + 1); @@ -421,7 +421,7 @@ void ModeManager::RemoveUserMode(UserMode *um) UserModesByName.erase(um->name); - std::vector::iterator it = std::find(UserModes.begin(), UserModes.end(), um); + auto it = std::find(UserModes.begin(), UserModes.end(), um); if (it != UserModes.end()) UserModes.erase(it); @@ -447,7 +447,7 @@ void ModeManager::RemoveChannelMode(ChannelMode *cm) if (cm->type == MODE_STATUS) { - ChannelModeStatus *cms = anope_dynamic_static_cast(cm); + auto *cms = anope_dynamic_static_cast(cm); unsigned want = cms->symbol; if (want >= ChannelModesIdx.size()) @@ -463,7 +463,7 @@ void ModeManager::RemoveChannelMode(ChannelMode *cm) ChannelModesByName.erase(cm->name); - std::vector::iterator it = std::find(ChannelModes.begin(), ChannelModes.end(), cm); + auto it = std::find(ChannelModes.begin(), ChannelModes.end(), cm); if (it != ChannelModes.end()) ChannelModes.erase(it); @@ -490,7 +490,7 @@ UserMode *ModeManager::FindUserModeByChar(char mode) ChannelMode *ModeManager::FindChannelModeByName(const Anope::string &name) { - std::map::iterator it = ChannelModesByName.find(name); + auto it = ChannelModesByName.find(name); if (it != ChannelModesByName.end()) return it->second; return NULL; @@ -498,7 +498,7 @@ ChannelMode *ModeManager::FindChannelModeByName(const Anope::string &name) UserMode *ModeManager::FindUserModeByName(const Anope::string &name) { - std::map::iterator it = UserModesByName.find(name); + auto it = UserModesByName.find(name); if (it != UserModesByName.end()) return it->second; return NULL; @@ -614,7 +614,7 @@ void ModeManager::ProcessModes() template static void StackerDel(std::map &map, T *obj) { - typename std::map::iterator it = map.find(obj); + auto it = map.find(obj); if (it != map.end()) { StackerInfo *si = it->second; @@ -636,12 +636,12 @@ void ModeManager::StackerDel(Channel *c) void ModeManager::StackerDel(Mode *m) { - for (std::map::const_iterator it = UserStackerObjects.begin(), it_end = UserStackerObjects.end(); it != it_end;) + for (auto it = UserStackerObjects.begin(), it_end = UserStackerObjects.end(); it != it_end;) { StackerInfo *si = it->second; ++it; - for (StackerInfo::ModeList::iterator it2 = si->AddModes.begin(), it2_end = si->AddModes.end(); it2 != it2_end;) + for (auto it2 = si->AddModes.begin(), it2_end = si->AddModes.end(); it2 != it2_end;) { if (it2->first == m) it2 = si->AddModes.erase(it2); @@ -649,7 +649,7 @@ void ModeManager::StackerDel(Mode *m) ++it2; } - for (StackerInfo::ModeList::iterator it2 = si->DelModes.begin(), it2_end = si->DelModes.end(); it2 != it2_end;) + for (auto it2 = si->DelModes.begin(), it2_end = si->DelModes.end(); it2 != it2_end;) { if (it2->first == m) it2 = si->DelModes.erase(it2); @@ -658,12 +658,12 @@ void ModeManager::StackerDel(Mode *m) } } - for (std::map::const_iterator it = ChannelStackerObjects.begin(), it_end = ChannelStackerObjects.end(); it != it_end;) + for (auto it = ChannelStackerObjects.begin(), it_end = ChannelStackerObjects.end(); it != it_end;) { StackerInfo *si = it->second; ++it; - for (StackerInfo::ModeList::iterator it2 = si->AddModes.begin(), it2_end = si->AddModes.end(); it2 != it2_end;) + for (auto it2 = si->AddModes.begin(), it2_end = si->AddModes.end(); it2 != it2_end;) { if (it2->first == m) it2 = si->AddModes.erase(it2); @@ -671,7 +671,7 @@ void ModeManager::StackerDel(Mode *m) ++it2; } - for (StackerInfo::ModeList::iterator it2 = si->DelModes.begin(), it2_end = si->DelModes.end(); it2 != it2_end;) + for (auto it2 = si->DelModes.begin(), it2_end = si->DelModes.end(); it2 != it2_end;) { if (it2->first == m) it2 = si->DelModes.erase(it2); @@ -804,7 +804,7 @@ bool Entry::Matches(User *u, bool full) const ChannelMode *cm = ModeManager::FindChannelModeByName(this->name); if (cm != NULL && cm->type == MODE_LIST) { - ChannelModeList *cml = anope_dynamic_static_cast(cm); + auto *cml = anope_dynamic_static_cast(cm); return cml->Matches(u, this); } } diff --git a/src/module.cpp b/src/module.cpp index 192d298ec..a19cbe56f 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -81,12 +81,12 @@ Module::~Module() /* Clear any active timers this module has */ TimerManager::DeleteTimersFor(this); - std::list::iterator it = std::find(ModuleManager::Modules.begin(), ModuleManager::Modules.end(), this); + auto it = std::find(ModuleManager::Modules.begin(), ModuleManager::Modules.end(), this); if (it != ModuleManager::Modules.end()) ModuleManager::Modules.erase(it); #if HAVE_LOCALIZATION - std::vector::iterator dit = std::find(Language::Domains.begin(), Language::Domains.end(), this->name); + auto dit = std::find(Language::Domains.begin(), Language::Domains.end(), this->name); if (dit != Language::Domains.end()) Language::Domains.erase(dit); #endif diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index 5afa8f61a..540ac91b9 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -149,7 +149,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u) } dlerror(); - Module *(*func)(const Anope::string &, const Anope::string &) = function_cast(dlsym(handle, "AnopeInit")); + auto *func = function_cast(dlsym(handle, "AnopeInit")); err = dlerror(); if (!func) { @@ -233,7 +233,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u) ModuleVersion ModuleManager::GetVersion(void *handle) { dlerror(); - ModuleVersionC (*func)() = function_cast(dlsym(handle, "AnopeVersion"));; + auto *func = function_cast(dlsym(handle, "AnopeVersion"));; if (!func) { Log() << "No version function found, not an Anope module"; @@ -314,7 +314,7 @@ ModuleReturn ModuleManager::DeleteModule(Module *m) Log(LOG_DEBUG) << "Unloading module " << m->name; dlerror(); - void (*destroy_func)(Module *m) = function_cast(dlsym(m->handle, "AnopeFini")); + auto *destroy_func = function_cast(dlsym(m->handle, "AnopeFini")); const char *err = dlerror(); if (!destroy_func || (err && *err)) { @@ -339,7 +339,7 @@ void ModuleManager::DetachAll(Module *mod) { for (auto &mods : EventHandlers) { - std::vector::iterator it2 = std::find(mods.begin(), mods.end(), mod); + auto it2 = std::find(mods.begin(), mods.end(), mod); if (it2 != mods.end()) mods.erase(it2); } diff --git a/src/nickalias.cpp b/src/nickalias.cpp index d6256dfa2..6f954801b 100644 --- a/src/nickalias.cpp +++ b/src/nickalias.cpp @@ -61,7 +61,7 @@ NickAlias::~NickAlias() if (this->nc) { /* Next: see if our core is still useful. */ - std::vector::iterator it = std::find(this->nc->aliases->begin(), this->nc->aliases->end(), this); + auto it = std::find(this->nc->aliases->begin(), this->nc->aliases->end(), this); if (it != this->nc->aliases->end()) this->nc->aliases->erase(it); if (this->nc->aliases->empty()) @@ -139,7 +139,7 @@ void NickAlias::UpdateSeen(User *u) NickAlias *NickAlias::Find(const Anope::string &nick) { - nickalias_map::const_iterator it = NickAliasList->find(nick); + auto it = NickAliasList->find(nick); if (it != NickAliasList->end()) { it->second->QueueUpdate(); @@ -203,7 +203,7 @@ Serializable *NickAlias::Type::Unserialize(Serializable *obj, Serialize::Data &d if (na->nc != core) { - std::vector::iterator it = std::find(na->nc->aliases->begin(), na->nc->aliases->end(), na); + auto it = std::find(na->nc->aliases->begin(), na->nc->aliases->end(), na); if (it != na->nc->aliases->end()) na->nc->aliases->erase(it); diff --git a/src/nickcore.cpp b/src/nickcore.cpp index 65c847f4a..127aea921 100644 --- a/src/nickcore.cpp +++ b/src/nickcore.cpp @@ -50,7 +50,7 @@ NickCore::~NickCore() if (!this->chanaccess->empty()) Log(LOG_DEBUG) << "Non-empty chanaccess list in destructor!"; - for (std::list::iterator it = this->users.begin(); it != this->users.end();) + for (auto it = this->users.begin(); it != this->users.end();) { User *user = *it++; user->Logout(); @@ -243,7 +243,7 @@ void NickCore::GetChannelReferences(std::deque &queue) NickCore *NickCore::Find(const Anope::string &nick) { - nickcore_map::const_iterator it = NickCoreList->find(nick); + auto it = NickCoreList->find(nick); if (it != NickCoreList->end()) { it->second->QueueUpdate(); diff --git a/src/opertype.cpp b/src/opertype.cpp index be5312a62..cf8891bb4 100644 --- a/src/opertype.cpp +++ b/src/opertype.cpp @@ -28,7 +28,7 @@ Oper::Oper(const Anope::string &n, OperType *o) : name(n), ot(o) Oper::~Oper() { - std::vector::iterator it = std::find(opers.begin(), opers.end(), this); + auto it = std::find(opers.begin(), opers.end(), this); if (it != opers.end()) opers.erase(it); } diff --git a/src/regchannel.cpp b/src/regchannel.cpp index f6b2271e9..5ddc65900 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -466,7 +466,7 @@ int16_t ChannelInfo::GetLevel(const Anope::string &priv) const return ACCESS_INVALID; } - Anope::map::const_iterator it = this->levels.find(priv); + auto it = this->levels.find(priv); if (it == this->levels.end()) return 0; return it->second; @@ -514,7 +514,7 @@ Anope::string ChannelInfo::GetIdealBan(User *u) const ChannelInfo *ChannelInfo::Find(const Anope::string &name) { - registered_channel_map::const_iterator it = RegisteredChannelList->find(name); + auto it = RegisteredChannelList->find(name); if (it != RegisteredChannelList->end()) { it->second->QueueUpdate(); diff --git a/src/serialize.cpp b/src/serialize.cpp index 5866d6946..fc6b0048e 100644 --- a/src/serialize.cpp +++ b/src/serialize.cpp @@ -208,7 +208,7 @@ void Type::UpdateTimestamp() Type *Serialize::Type::Find(const Anope::string &name) { - std::map::iterator it = Types.find(name); + auto it = Types.find(name); if (it != Types.end()) return it->second; return NULL; diff --git a/src/servers.cpp b/src/servers.cpp index fab996470..aef5fe186 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -272,7 +272,7 @@ void Server::Sync(bool sync_links) FOREACH_MOD(OnPreUplinkSync, (this)); } - for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end;) + for (auto it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end;) { Channel *c = it->second; ++it; diff --git a/src/socketengines/epoll.cpp b/src/socketengines/epoll.cpp index 03d85655d..1bbb49da1 100644 --- a/src/socketengines/epoll.cpp +++ b/src/socketengines/epoll.cpp @@ -93,7 +93,7 @@ void SocketEngine::Process() { epoll_event &ev = events[i]; - std::map::iterator it = Sockets.find(ev.data.fd); + auto it = Sockets.find(ev.data.fd); if (it == Sockets.end()) continue; Socket *s = it->second; diff --git a/src/threadengine.cpp b/src/threadengine.cpp index a159f462d..eee18523f 100644 --- a/src/threadengine.cpp +++ b/src/threadengine.cpp @@ -20,7 +20,7 @@ static void *entry_point(void *parameter) { - Thread *thread = static_cast(parameter); + auto *thread = static_cast(parameter); thread->Run(); thread->SetExitState(); return NULL; diff --git a/src/timers.cpp b/src/timers.cpp index 2b4830164..7c2430f5b 100644 --- a/src/timers.cpp +++ b/src/timers.cpp @@ -84,7 +84,7 @@ void TimerManager::AddTimer(Timer *t) void TimerManager::DelTimer(Timer *t) { std::pair::iterator, std::multimap::iterator> itpair = Timers.equal_range(t->GetTimer()); - for (std::multimap::iterator i = itpair.first; i != itpair.second; ++i) + for (auto i = itpair.first; i != itpair.second; ++i) { if (i->second == t) { @@ -98,7 +98,7 @@ void TimerManager::TickTimers() { while (!Timers.empty()) { - std::multimap::iterator it = Timers.begin(); + auto it = Timers.begin(); Timer *t = it->second; if (t->GetTimer() > Anope::CurTime) @@ -115,7 +115,7 @@ void TimerManager::TickTimers() void TimerManager::DeleteTimersFor(Module *m) { - for (std::multimap::iterator it = Timers.begin(), it_next = it; it != Timers.end(); it = it_next) + for (auto it = Timers.begin(), it_next = it; it != Timers.end(); it = it_next) { ++it_next; if (it->second->GetOwner() == m) diff --git a/src/users.cpp b/src/users.cpp index 3fd744c98..8a35d16d0 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -99,7 +99,7 @@ static void CollideKill(User *target, const Anope::string &reason) IRCD->SendQuit(target, reason); // Reintroduce my client - if (BotInfo *bi = dynamic_cast(target)) + if (auto *bi = dynamic_cast(target)) bi->OnKill(); else target->Quit(reason); @@ -415,7 +415,7 @@ void User::Logout() Log(this, "account") << "is no longer identified as " << this->nc->display; - std::list::iterator it = std::find(this->nc->users.begin(), this->nc->users.end(), this); + auto it = std::find(this->nc->users.begin(), this->nc->users.end(), this); if (it != this->nc->users.end()) this->nc->users.erase(it); @@ -741,7 +741,7 @@ const User::ModeList &User::GetModeList() const Membership *User::FindChannel(Channel *c) const { - User::ChanUserList::const_iterator it = this->chans.find(c); + auto it = this->chans.find(c); if (it != this->chans.end()) return it->second; return NULL; @@ -854,7 +854,7 @@ User *User::Find(const Anope::string &name, bool nick_only) { if (!nick_only && IRCD && IRCD->RequiresID) { - user_map::iterator it = UserListByUID.find(name); + auto it = UserListByUID.find(name); if (it != UserListByUID.end()) return it->second; @@ -862,7 +862,7 @@ User *User::Find(const Anope::string &name, bool nick_only) return NULL; } - user_map::iterator it = UserListByNick.find(name); + auto it = UserListByNick.find(name); if (it != UserListByNick.end()) return it->second; diff --git a/src/xline.cpp b/src/xline.cpp index 6f7cbd835..a5492f4f6 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -238,7 +238,7 @@ void XLineManager::RegisterXLineManager(XLineManager *xlm) void XLineManager::UnregisterXLineManager(XLineManager *xlm) { - std::list::iterator it = std::find(XLineManagers.begin(), XLineManagers.end(), xlm); + auto it = std::find(XLineManagers.begin(), XLineManagers.end(), xlm); if (it != XLineManagers.end()) XLineManagers.erase(it); @@ -320,11 +320,11 @@ void XLineManager::RemoveXLine(XLine *x) { /* called from the destructor */ - std::vector::iterator it = std::find(this->xlines->begin(), this->xlines->end(), x); + auto it = std::find(this->xlines->begin(), this->xlines->end(), x); if (!x->id.empty()) { - std::multimap::iterator it2 = XLinesByUID->find(x->id), it3 = XLinesByUID->upper_bound(x->id); + auto it2 = XLinesByUID->find(x->id), it3 = XLinesByUID->upper_bound(x->id); for (; it2 != XLinesByUID->end() && it2 != it3; ++it2) if (it2->second == x) { @@ -342,11 +342,11 @@ void XLineManager::RemoveXLine(XLine *x) bool XLineManager::DelXLine(XLine *x) { - std::vector::iterator it = std::find(this->xlines->begin(), this->xlines->end(), x); + auto it = std::find(this->xlines->begin(), this->xlines->end(), x); if (!x->id.empty()) { - std::multimap::iterator it2 = XLinesByUID->find(x->id), it3 = XLinesByUID->upper_bound(x->id); + auto it2 = XLinesByUID->find(x->id), it3 = XLinesByUID->upper_bound(x->id); for (; it2 != XLinesByUID->end() && it2 != it3; ++it2) if (it2->second == x) { @@ -441,9 +441,9 @@ bool XLineManager::CanAdd(CommandSource &source, const Anope::string &mask, time XLine *XLineManager::HasEntry(const Anope::string &mask) { - std::multimap::iterator it = XLinesByUID->find(mask); + auto it = XLinesByUID->find(mask); if (it != XLinesByUID->end()) - for (std::multimap::iterator it2 = XLinesByUID->upper_bound(mask); it != it2; ++it) + for (auto it2 = XLinesByUID->upper_bound(mask); it != it2; ++it) if (it->second->manager == NULL || it->second->manager == this) { it->second->QueueUpdate();