summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorteor <teor2345@gmail.com>2017-11-08 14:18:46 +1100
committerNick Mathewson <nickm@torproject.org>2017-11-08 10:45:18 -0500
commit6e4ebd41bb5479ffe05ed173a1d7aeffcf592248 (patch)
tree934f680d1ea59e0ddf6368fc851711e5325ac2cb
parent4f944cc4cc1971baf2924bc3f713feef7b010691 (diff)
downloadtor-6e4ebd41bb5479ffe05ed173a1d7aeffcf592248.tar.gz
tor-6e4ebd41bb5479ffe05ed173a1d7aeffcf592248.zip
Stop calculating total twice in frac_nodes_with_descriptors()
Cleanup after 23318.
-rw-r--r--src/or/routerlist.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index c9d2cbaeaf..8f53c02009 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -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);