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

[or-cvs] r7048: simplify compare_cached_resolves_by_expiry() to make it matc (tor/trunk/src/or)



Author: arma
Date: 2006-08-14 03:08:29 -0400 (Mon, 14 Aug 2006)
New Revision: 7048

Modified:
   tor/trunk/src/or/connection_edge.c
   tor/trunk/src/or/dns.c
Log:
simplify compare_cached_resolves_by_expiry() to make it match
the idioms of other compare functions. hopefully i didn't
break it?


Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c	2006-08-14 06:29:40 UTC (rev 7047)
+++ tor/trunk/src/or/connection_edge.c	2006-08-14 07:08:29 UTC (rev 7048)
@@ -321,7 +321,7 @@
  * application connections. Rather than waiting a fixed amount of
  * time between each retry, we wait only 5 seconds for the first,
  * 10 seconds for the second, and 15 seconds for each retry after
- * that. Hopefully this will improve the expected experience. */
+ * that. Hopefully this will improve the expected user experience. */
 static int
 compute_socks_timeout(edge_connection_t *conn)
 {

Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c	2006-08-14 06:29:40 UTC (rev 7047)
+++ tor/trunk/src/or/dns.c	2006-08-14 07:08:29 UTC (rev 7048)
@@ -208,12 +208,7 @@
 _compare_cached_resolves_by_expiry(const void *_a, const void *_b)
 {
   const cached_resolve_t *a = _a, *b = _b;
-  if (a->expire < b->expire)
-    return -1;
-  else if (a->expire == b->expire)
-    return 0;
-  else
-    return 1;
+  return a->expire - b->expire;
 }
 
 /** Priority queue of cached_resolve_t objects to let us know when they