[tor/master] Use SMARTLIST_FOREACH in connection_count_moribund() per code review

commit a403230fe38d396189a32bc525aa596444d88b61 Author: Andrea Shepard <andrea@torproject.org> Date: Sat Aug 20 03:12:58 2016 +0000 Use SMARTLIST_FOREACH in connection_count_moribund() per code review --- src/or/main.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/or/main.c b/src/or/main.c index 18c0948..9741f15 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -655,20 +655,18 @@ close_closeable_connections(void) MOCK_IMPL(int, connection_count_moribund, (void)) { - int i, moribund = 0; - connection_t *conn; + int moribund = 0; /* * Count things we'll try to kill when close_closeable_connections() * runs next. */ - for (i = 0; i < smartlist_len(closeable_connection_lst); ++i) { - conn = smartlist_get(closeable_connection_lst, i); + SMARTLIST_FOREACH_BEGIN(closeable_connection_lst, connection_t *, conn) { if (conn->conn_array_index < 0 || conn->marked_for_close) { ++moribund; } - } + } SMARTLIST_FOREACH_END(conn); return moribund; }
participants (1)
-
nickm@torproject.org