]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - pdns/dnsname.hh
turns out we were using libc tolower in performance sensitive places.. top in perf
[thirdparty/pdns.git] / pdns / dnsname.hh
index 6e7e744ac863bf0c829890b9c8118388276fc31c..7c9326e08c21c786ee89c05afab4024235f10b33 100644 (file)
@@ -26,6 +26,12 @@ uint32_t burtleCI(const unsigned char* k, uint32_t lengh, uint32_t init);
    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
 {
@@ -83,7 +89,7 @@ public:
     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
   }
 
@@ -102,13 +108,6 @@ private:
 
 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
 {