auto us = d_storage.crbegin();
auto p = rhs.d_storage.crbegin();
for(; us != d_storage.crend() && p != rhs.d_storage.crend(); ++us, ++p) { // why does this go backward?
- if(tolower(*p) != tolower(*us))
+ if(dns2_tolower(*p) != dns2_tolower(*us))
return false;
}
return true;
NOTE: For now, everything MUST be . terminated, otherwise it is an error
*/
+inline char dns2_tolower(char c)
+{
+ if(c>='A' && c<='Z')
+ c+='a'-'A';
+ return c;
+}
class DNSName
{
return std::lexicographical_compare(d_storage.rbegin(), d_storage.rend(),
rhs.d_storage.rbegin(), rhs.d_storage.rend(),
[](const char& a, const char& b) {
- return tolower(a) < tolower(b);
+ return dns2_tolower(a) < dns2_tolower(b);
}); // note that this is case insensitive, including on the label lengths
}
size_t hash_value(DNSName const& d);
-inline char dns2_tolower(char c)
-{
- if(c>='A' && c<='Z')
- c+='a'-'A';
- return c;
-}
-
inline bool DNSName::canonCompare(const DNSName& rhs) const
{