From 6969bd9a02895ae7dc80264fb59adba4a44f79a1 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 15 Aug 2014 16:23:22 -0400 Subject: Autoconvert most circuit-list iterations to smartlist iterations Breaks compilation. Used this coccinelle script: @@ identifier c; typedef circuit_t; iterator name TOR_LIST_FOREACH; iterator name SMARTLIST_FOREACH_BEGIN; statement S; @@ - circuit_t *c; ... - TOR_LIST_FOREACH(c, \(&global_circuitlist\|circuit_get_global_list()\), head) + SMARTLIST_FOREACH_BEGIN(circuit_get_global_list(), circuit_t *, c) S + SMARTLIST_FOREACH_END(c); --- src/or/relay.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/or/relay.c') diff --git a/src/or/relay.c b/src/or/relay.c index f42602d412..e013925746 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -2322,15 +2322,15 @@ packed_cell_free(packed_cell_t *cell) void dump_cell_pool_usage(int severity) { - circuit_t *c; int n_circs = 0; int n_cells = 0; - TOR_LIST_FOREACH(c, circuit_get_global_list(), head) { + SMARTLIST_FOREACH_BEGIN(circuit_get_global_list(), circuit_t *, c) { n_cells += c->n_chan_cells.n; if (!CIRCUIT_IS_ORIGIN(c)) n_cells += TO_OR_CIRCUIT(c)->p_chan_cells.n; ++n_circs; } + SMARTLIST_FOREACH_END(c); tor_log(severity, LD_MM, "%d cells allocated on %d circuits. %d cells leaked.", n_cells, n_circs, (int)total_cells_allocated - n_cells); -- cgit v1.2.3-54-g00ecf