]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Stop calculating total twice in frac_nodes_with_descriptors()
authorteor <teor2345@gmail.com>
Wed, 8 Nov 2017 03:18:46 +0000 (14:18 +1100)
committerNick Mathewson <nickm@torproject.org>
Wed, 8 Nov 2017 15:45:18 +0000 (10:45 -0500)
Cleanup after 23318.

src/or/routerlist.c

index c9d2cbaeaf9969838aa9430b3f6dde1362756113..8f53c0200921d8b316ab76f151707090a19dc24a 100644 (file)
@@ -2768,12 +2768,10 @@ frac_nodes_with_descriptors(const smartlist_t *sl,
     return ((double)n_with_descs) / (double)smartlist_len(sl);
   }
 
-  total = present = 0.0;
+  present = 0.0;
   SMARTLIST_FOREACH_BEGIN(sl, const node_t *, node) {
-    const double bw = bandwidths[node_sl_idx];
-    total += bw;
     if (node_has_descriptor(node))
-      present += bw;
+      present += bandwidths[node_sl_idx];
   } SMARTLIST_FOREACH_END(node);
 
   tor_free(bandwidths);