[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Expunge remaining places where we used "tree" to mean "asso...



Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv2410/src/or

Modified Files:
	circuitlist.c connection_edge.c dns.c main.c 
Log Message:
Expunge remaining places where we used "tree" to mean "associative array".

Index: circuitlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/circuitlist.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- circuitlist.c	3 Dec 2005 02:12:37 -0000	1.77
+++ circuitlist.c	3 Dec 2005 02:21:30 -0000	1.78
@@ -53,10 +53,10 @@
   return (((unsigned)a->circ_id)<<16) ^ (unsigned)(uintptr_t)(a->or_conn);
 }
 
-static HT_HEAD(orconn_circid_tree, orconn_circid_circuit_map_t) orconn_circid_circuit_map = HT_INITIALIZER();
-HT_PROTOTYPE(orconn_circid_tree, orconn_circid_circuit_map_t, node,
+static HT_HEAD(orconn_circid_map, orconn_circid_circuit_map_t) orconn_circid_circuit_map = HT_INITIALIZER();
+HT_PROTOTYPE(orconn_circid_map, orconn_circid_circuit_map_t, node,
              _orconn_circid_entry_hash, _orconn_circid_entries_eq);
-HT_GENERATE(orconn_circid_tree, orconn_circid_circuit_map_t, node,
+HT_GENERATE(orconn_circid_map, orconn_circid_circuit_map_t, node,
             _orconn_circid_entry_hash, _orconn_circid_entries_eq, 0.6,
             malloc, realloc, free);
 
@@ -64,8 +64,6 @@
  * used to improve performance when many cells arrive in a row from the
  * same circuit.
  */
-/* (We tried using splay trees, but round-robin turned out to make them
- * suck.) */
 orconn_circid_circuit_map_t *_last_circid_orconn_ent = NULL;
 
 /** Set the p_conn or n_conn field of a circuit <b>circ</b>, along
@@ -108,7 +106,7 @@
   if (old_conn) { /* we may need to remove it from the conn-circid map */
     search.circ_id = old_id;
     search.or_conn = old_conn;
-    found = HT_REMOVE(orconn_circid_tree, &orconn_circid_circuit_map, &search);
+    found = HT_REMOVE(orconn_circid_map, &orconn_circid_circuit_map, &search);
     if (found) {
       tor_free(found);
     }
@@ -121,7 +119,7 @@
   /* now add the new one to the conn-circid map */
   search.circ_id = id;
   search.or_conn = conn;
-  found = HT_FIND(orconn_circid_tree, &orconn_circid_circuit_map, &search);
+  found = HT_FIND(orconn_circid_map, &orconn_circid_circuit_map, &search);
   if (found) {
     found->circuit = circ;
   } else {
@@ -129,7 +127,7 @@
     found->circ_id = id;
     found->or_conn = conn;
     found->circuit = circ;
-    HT_INSERT(orconn_circid_tree, &orconn_circid_circuit_map, found);
+    HT_INSERT(orconn_circid_map, &orconn_circid_circuit_map, found);
   }
   ++conn->n_circuits;
 }
@@ -397,7 +395,7 @@
   } else {
     search.circ_id = circ_id;
     search.or_conn = conn;
-    found = HT_FIND(orconn_circid_tree, &orconn_circid_circuit_map, &search);
+    found = HT_FIND(orconn_circid_map, &orconn_circid_circuit_map, &search);
     _last_circid_orconn_ent = found;
   }
   if (found && found->circuit)
@@ -410,11 +408,11 @@
     circuit_t *circ;
     for (circ=global_circuitlist;circ;circ = circ->next) {
       if (circ->p_conn == conn && circ->p_circ_id == circ_id) {
-        warn(LD_BUG, "circuit matches p_conn, but not in tree (Bug!)");
+        warn(LD_BUG, "circuit matches p_conn, but not in hash table (Bug!)");
         return circ;
       }
       if (circ->n_conn == conn && circ->n_circ_id == circ_id) {
-        warn(LD_BUG, "circuit matches n_conn, but not in tree (Bug!)");
+        warn(LD_BUG, "circuit matches n_conn, but not in hash table (Bug!)");
         return circ;
       }
     }

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.364
retrieving revision 1.365
diff -u -d -r1.364 -r1.365
--- connection_edge.c	30 Nov 2005 06:38:41 -0000	1.364
+++ connection_edge.c	3 Dec 2005 02:21:30 -0000	1.365
@@ -424,8 +424,8 @@
 }
 
 /** A client-side struct to remember requests to rewrite addresses
- * to new addresses. These structs make up a tree, with addressmap
- * below as its root.
+ * to new addresses. These structs are stored the hash table
+ * "addressmap" below.
  *
  * There are 5 ways to set an address mapping:
  * - A MapAddress command from the controller [permanent]
@@ -455,10 +455,10 @@
   char *hostname_address;
 } virtaddress_entry_t;
 
-/** The tree of client-side address rewrite instructions. */
+/** A hash table to store client-side address rewrite instructions. */
 static strmap_t *addressmap=NULL;
 /**
- * Tree mapping addresses to which virtual address, if any, we
+ * Table mapping addresses to which virtual address, if any, we
  * assigned them to.
  *
  * We maintain the following invariant: if [A,B] is in

Index: dns.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dns.c,v
retrieving revision 1.175
retrieving revision 1.176
diff -u -d -r1.175 -r1.176
--- dns.c	3 Dec 2005 02:01:18 -0000	1.175
+++ dns.c	3 Dec 2005 02:21:30 -0000	1.176
@@ -80,7 +80,7 @@
 static HT_HEAD(cache_map, cached_resolve_t) cache_root;
 
 /** Function to compare hashed resolves on their addresses; used to
- * implement splay trees. */
+ * implement hash tables. */
 static INLINE int
 cached_resolves_eq(cached_resolve_t *a, cached_resolve_t *b)
 {
@@ -279,7 +279,7 @@
   /* 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. */
+  /* now check the hash table to see if 'address' is already there. */
   strlcpy(search.address, exitconn->address, sizeof(search.address));
   resolve = HT_FIND(cache_map, &cache_root, &search);
   if (resolve) { /* already there */
@@ -536,7 +536,7 @@
       newest_cached_resolve = tmp;
   }
 
-  /* remove resolve from the tree */
+  /* remove resolve from the map */
   HT_REMOVE(cache_map, &cache_root, resolve);
 
   tor_free(resolve);

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.596
retrieving revision 1.597
diff -u -d -r1.596 -r1.597
--- main.c	30 Nov 2005 04:28:41 -0000	1.596
+++ main.c	3 Dec 2005 02:21:31 -0000	1.597
@@ -1036,7 +1036,7 @@
 {
   int loop_result;
 
-  dns_init(); /* initialize dns resolve tree, spawn workers if needed */
+  dns_init(); /* initialize dns resolve map, spawn workers if needed */
 
   handle_signals(1);