From: teor Date: Wed, 8 Nov 2017 03:18:46 +0000 (+1100) Subject: Stop calculating total twice in frac_nodes_with_descriptors() X-Git-Tag: tor-0.3.2.4-alpha~6^2~1^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6e4ebd41bb5479ffe05ed173a1d7aeffcf592248;p=thirdparty%2Ftor.git Stop calculating total twice in frac_nodes_with_descriptors() Cleanup after 23318. --- 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);