[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] stop wasting time doing a case insensitive comparison for e...
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] stop wasting time doing a case insensitive comparison for e...
- From: arma@xxxxxxxx (Roger Dingledine)
- Date: Wed,  6 Apr 2005 16:25:24 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Wed, 06 Apr 2005 16:26:02 -0400
- Reply-to: or-dev@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/or
Modified Files:
	dns.c 
Log Message:
stop wasting time doing a case insensitive comparison for every dns name
every time we do any lookup. canonicalize the names to lowercase and be
done with it.
Index: dns.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/dns.c,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- dns.c	6 Apr 2005 06:43:21 -0000	1.146
+++ dns.c	6 Apr 2005 20:25:21 -0000	1.147
@@ -81,7 +81,7 @@
 static int compare_cached_resolves(struct cached_resolve *a,
                                    struct cached_resolve *b) {
   /* make this smarter one day? */
-  return strncasecmp(a->address, b->address, MAX_ADDRESSLEN);
+  return strncmp(a->address, b->address, MAX_ADDRESSLEN);
 }
 
 SPLAY_PROTOTYPE(cache_tree, cached_resolve, node, compare_cached_resolves);
@@ -246,6 +246,9 @@
    * resolves in the tree. */
   purge_expired_resolves(now);
 
+  /* lower-case exitconn->address, so it's in canonical form */
+  tor_strlower(exitconn->address);
+
   /* now check the tree to see if 'address' is already there. */
   strlcpy(search.address, exitconn->address, sizeof(search.address));
   resolve = SPLAY_FIND(cache_tree, &cache_root, &search);