From 441bd151da733d32e194de6e4a1744ae273b83ee Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 31 Oct 2020 20:03:19 +0000 Subject: Add stdalgo::iterator_range and switch config tag reading to use it. This allows us to use range-based for loops which were not possible with the previous config tag system. --- src/modules/m_codepage.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/modules/m_codepage.cpp') diff --git a/src/modules/m_codepage.cpp b/src/modules/m_codepage.cpp index 3343efbef..fcff62ff5 100644 --- a/src/modules/m_codepage.cpp +++ b/src/modules/m_codepage.cpp @@ -124,11 +124,9 @@ class ModuleCodepage AllowedChars newallowedchars; AllowedChars newallowedfrontchars; - ConfigTagList cpchars = ServerInstance->Config->ConfTags("cpchars"); - for (ConfigIter i = cpchars.first; i != cpchars.second; ++i) - { - ConfigTag* tag = i->second; + for (auto& [_, tag] : ServerInstance->Config->ConfTags("cpchars")) + { unsigned char begin = tag->getUInt("begin", tag->getUInt("index", 0), 1, UCHAR_MAX); if (!begin) throw ModuleException(" tag without index or begin specified at " + tag->getTagLocation()); @@ -162,11 +160,9 @@ class ModuleCodepage unsigned char newcasemap[UCHAR_MAX]; for (size_t i = 0; i < UCHAR_MAX; ++i) newcasemap[i] = i; - ConfigTagList cpcase = ServerInstance->Config->ConfTags("cpcase"); - for (ConfigIter i = cpcase.first; i != cpcase.second; ++i) - { - ConfigTag* tag = i->second; + for (auto& [_, tag] : ServerInstance->Config->ConfTags("cpcase")) + { unsigned char lower = tag->getUInt("lower", 0, 1, UCHAR_MAX); if (!lower) throw ModuleException(" is required at " + tag->getTagLocation()); -- cgit v1.3.1-10-gc9f91