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

[or-cvs] r17018: {tor} Switch a should-benee-dless check for an assert. (tor/trunk/src/or)



Author: nickm
Date: 2008-09-30 09:59:12 -0400 (Tue, 30 Sep 2008)
New Revision: 17018

Modified:
   tor/trunk/src/or/rephist.c
Log:
Switch a should-benee-dless check for an assert.

Modified: tor/trunk/src/or/rephist.c
===================================================================
--- tor/trunk/src/or/rephist.c	2008-09-30 13:11:48 UTC (rev 17017)
+++ tor/trunk/src/or/rephist.c	2008-09-30 13:59:12 UTC (rev 17018)
@@ -293,13 +293,15 @@
   int was_in_run = 1;
   char tbuf[ISO_TIME_LEN+1];
 
+  tor_assert(hist);
+
   if (!started_tracking_stability)
     started_tracking_stability = time(NULL);
-  if (hist && !hist->start_of_run) {
+  if (!hist->start_of_run) {
     hist->start_of_run = when;
     was_in_run = 0;
   }
-  if (hist && hist->start_of_downtime) {
+  if (hist->start_of_downtime) {
     long down_length;
 
     format_local_iso_time(tbuf, hist->start_of_downtime);
@@ -332,7 +334,9 @@
   int was_running = 0;
   if (!started_tracking_stability)
     started_tracking_stability = time(NULL);
-  if (hist && hist->start_of_run) {
+
+  tor_assert(hist);
+  if (hist->start_of_run) {
     /*XXXX We could treat failed connections differently from failed
      * connect attempts. */
     long run_length = when - hist->start_of_run;
@@ -350,7 +354,7 @@
              hex_str(id, DIGEST_LEN), tbuf, hist->weighted_uptime,
              hist->total_weighted_time);
   }
-  if (hist && !hist->start_of_downtime) {
+  if (!hist->start_of_downtime) {
     hist->start_of_downtime = when;
 
     if (!was_running)