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

[or-cvs] Fix a couple of things that make GCC complain with verbose ...



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

Modified Files:
	config.c dirserv.c or.h policies.c 
Log Message:
Fix a couple of things that make GCC complain with verbose warnings on.  Also, fix some whitespace.

Index: config.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.548
retrieving revision 1.549
diff -u -p -d -r1.548 -r1.549
--- config.c	2 Apr 2006 02:59:48 -0000	1.548
+++ config.c	8 Apr 2006 05:43:52 -0000	1.549
@@ -1441,7 +1441,7 @@ config_assign(config_format_t *fmt, void
  * ok, then throw out the old one and stick with the new one. Else,
  * revert to old and return failure.  Return 0 on success, -1 on bad
  * keys, -2 on bad values, -3 on bad transition, and -4 on failed-to-set.
- * 
+ *
  * If not success, point *<b>msg</b> to a newly allocated string describing
  * what went wrong.
  */

Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.322
retrieving revision 1.323
diff -u -p -d -r1.322 -r1.323
--- dirserv.c	3 Apr 2006 06:23:24 -0000	1.322
+++ dirserv.c	8 Apr 2006 05:43:52 -0000	1.323
@@ -1192,6 +1192,12 @@ static uint32_t stable_uptime = 0; /* st
 static uint32_t fast_bandwidth = 0;
 static uint32_t guard_bandwidth = 0;
 
+static INLINE int
+real_uptime(routerinfo_t *router, time_t now)
+{
+  return router->uptime + (now - router->cache_info.published_on);
+}
+
 /** Return 1 if <b>router</b> is not suitable for these parameters, else 0.
  * If <b>need_uptime</b> is non-zero, we require a minimum uptime.
  * If <b>need_capacity</b> is non-zero, we require a minimum advertised
@@ -1203,7 +1209,7 @@ dirserv_thinks_router_is_unreliable(time
                                     int need_uptime, int need_capacity)
 {
   if (need_uptime &&
-      router->uptime+(now - router->cache_info.published_on) < stable_uptime)
+      (unsigned)real_uptime(router, now) < stable_uptime)
     return 1;
   if (need_capacity &&
       router_get_advertised_bandwidth(router) < fast_bandwidth)
@@ -1236,7 +1242,7 @@ dirserv_compute_performance_thresholds(r
     if (ri->is_running && ri->is_valid) {
       uint32_t *up = tor_malloc(sizeof(uint32_t));
       uint32_t *bw = tor_malloc(sizeof(uint32_t));
-      *up = (uint32_t) ri->uptime + (now - ri->cache_info.published_on);
+      *up = (uint32_t) real_uptime(ri, now);
       smartlist_add(uptimes, up);
       *bw = router_get_advertised_bandwidth(ri);
       smartlist_add(bandwidths, bw);

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.819
retrieving revision 1.820
diff -u -p -d -r1.819 -r1.820
--- or.h	3 Apr 2006 06:23:24 -0000	1.819
+++ or.h	8 Apr 2006 05:43:52 -0000	1.820
@@ -1621,7 +1621,6 @@ int resolve_my_address(or_options_t *opt
 void options_init(or_options_t *options);
 int options_init_from_torrc(int argc, char **argv);
 int options_init_logs(or_options_t *options, int validate_only);
-void addr_policy_free(addr_policy_t *p);
 int option_is_recognized(const char *key);
 const char *option_get_canonical_name(const char *key);
 config_line_t *option_get_assignment(or_options_t *options,

Index: policies.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/policies.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -d -r1.1 -r1.2
--- policies.c	27 Mar 2006 02:25:34 -0000	1.1
+++ policies.c	8 Apr 2006 05:43:52 -0000	1.2
@@ -262,7 +262,8 @@ load_policy_from_option(config_line_t *c
   }
 }
 
-void policies_parse_from_options(or_options_t *options)
+void
+policies_parse_from_options(or_options_t *options)
 {
   load_policy_from_option(options->SocksPolicy, &socks_policy, -1);
   load_policy_from_option(options->DirPolicy, &dir_policy, -1);
@@ -273,7 +274,6 @@ void policies_parse_from_options(or_opti
   parse_reachable_addresses();
 }
 
-
 /** Compare two provided address policy items, and return -1, 0, or 1
  * if the first is less than, equal to, or greater than the second. */
 static int