summaryrefslogtreecommitdiff
path: root/src/hashcomp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hashcomp.cpp')
-rw-r--r--src/hashcomp.cpp24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp
index 92de37e61..2cb6fb972 100644
--- a/src/hashcomp.cpp
+++ b/src/hashcomp.cpp
@@ -483,29 +483,17 @@ std::string& irc::stringjoiner::GetJoined()
return joined;
}
-irc::portparser::portparser(const std::string &source, bool allow_overlapped) : in_range(0), range_begin(0), range_end(0), overlapped(allow_overlapped)
+irc::portparser::portparser(const std::string &source, bool allow_overlapped)
+ : sep(source), in_range(0), range_begin(0), range_end(0), overlapped(allow_overlapped)
{
- sep = new irc::commasepstream(source);
- overlap_set.clear();
-}
-
-irc::portparser::~portparser()
-{
- delete sep;
}
bool irc::portparser::Overlaps(long val)
{
- if (!overlapped)
+ if (overlapped)
return false;
- if (overlap_set.find(val) == overlap_set.end())
- {
- overlap_set[val] = true;
- return false;
- }
- else
- return true;
+ return (!overlap_set.insert(val).second);
}
long irc::portparser::GetToken()
@@ -533,14 +521,14 @@ long irc::portparser::GetToken()
}
std::string x;
- sep->GetToken(x);
+ sep.GetToken(x);
if (x.empty())
return 0;
while (Overlaps(atoi(x.c_str())))
{
- if (!sep->GetToken(x))
+ if (!sep.GetToken(x))
return 0;
}