]> granicus.if.org Git - pdns/commitdiff
speedups in case lowering code for already lowercase domains
authorBert Hubert <bert.hubert@netherlabs.nl>
Sun, 8 Apr 2007 22:06:24 +0000 (22:06 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Sun, 8 Apr 2007 22:06:24 +0000 (22:06 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1021 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/misc.hh

index 527c3100dd0e8b79487c5961400ebe794fc85ebc..9d055bad0124e16a72c0775ab41b4f0c0aad0596 100644 (file)
@@ -246,8 +246,8 @@ inline const string toLower(const string &upper)
   string reply(upper);
   char c;
   for(unsigned int i = 0; i < reply.length(); i++) {
-    c = dns_tolower(reply[i]);
-    if( c != reply[i])
+    c = dns_tolower(upper[i]);
+    if( c != upper[i])
       reply[i] = c;
   }
   return reply;
@@ -260,11 +260,11 @@ inline const string toLowerCanonic(const string &upper)
     unsigned int i, limit= ( unsigned int ) reply.length();
     char c;
     for(i = 0; i < limit ; i++) {
-      c = dns_tolower(reply[i]);
-      if(c != reply[i])
+      c = dns_tolower(upper[i]);
+      if(c != upper[i])
        reply[i] = c;
     }   
-    if(reply[i-1]=='.')
+    if(upper[i-1]=='.')
       reply.resize(i-1);
   }