summaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorAndrea Shepard <andrea@torproject.org>2016-08-20 03:12:58 +0000
committerAndrea Shepard <andrea@torproject.org>2016-08-20 03:12:58 +0000
commita403230fe38d396189a32bc525aa596444d88b61 (patch)
tree85a57cf15983eeaef557fd7e62a6df7b53dbb453 /src/or/main.c
parentdbdac1dc27b4ad1d98e8280e1f8b3a3aa2f60c15 (diff)
downloadtor-a403230fe38d396189a32bc525aa596444d88b61.tar.gz
tor-a403230fe38d396189a32bc525aa596444d88b61.zip
Use SMARTLIST_FOREACH in connection_count_moribund() per code review
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 18c09487c3..9741f15022 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;
}