aboutsummaryrefslogtreecommitdiff
path: root/src/helperfuncs.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2024-09-07 19:16:48 +0100
committerGravatar Sadie Powell2024-09-07 19:26:29 +0100
commit73a98ce7bedfff951244cb4a15eb487073d64e74 (patch)
tree0d5a68a029369392b2a20622abe04be4844f8b40 /src/helperfuncs.cpp
parentRelease v4.3.0. (diff)
Use string_view in InspIRCd::Is{FQDN,Host,SID}.
Diffstat (limited to 'src/helperfuncs.cpp')
-rw-r--r--src/helperfuncs.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index d3356039d..bbb8ad668 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -292,7 +292,7 @@ bool InspIRCd::DefaultIsUser(const std::string_view& n)
return true;
}
-bool InspIRCd::IsHost(const std::string& host, bool allowsimple)
+bool InspIRCd::IsHost(const std::string_view& host, bool allowsimple)
{
// Hostnames must be non-empty and shorter than the maximum hostname length.
if (host.empty() || host.length() > ServerInstance->Config->Limits.MaxHost)
@@ -301,10 +301,10 @@ bool InspIRCd::IsHost(const std::string& host, bool allowsimple)
unsigned int numdashes = 0;
unsigned int numdots = 0;
bool seendot = false;
- const std::string::const_iterator hostend = host.end() - 1;
- for (std::string::const_iterator iter = host.begin(); iter != host.end(); ++iter)
+ const auto hostend = host.end() - 1;
+ for (auto iter = host.begin(); iter != host.end(); ++iter)
{
- unsigned char chr = static_cast<unsigned char>(*iter);
+ const auto chr = static_cast<unsigned char>(*iter);
// If the current character is a label separator.
if (chr == '.')
@@ -351,7 +351,7 @@ bool InspIRCd::IsHost(const std::string& host, bool allowsimple)
return numdots || allowsimple;
}
-bool InspIRCd::IsSID(const std::string& str)
+bool InspIRCd::IsSID(const std::string_view& str)
{
/* Returns true if the string given is exactly 3 characters long,
* starts with a digit, and the other two characters are A-Z or digits