diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-07-17 09:33:38 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-07-17 10:34:08 -0400 |
commit | 7faf115dfffaf12cdae98eac71fc6811059c6657 (patch) | |
tree | 61d42ba38202e6cb233cc89082228abbd55a4b56 /src/or/connection.c | |
parent | 21c6c8485367ce66ab0791c153177c17bccd25c5 (diff) | |
download | tor-7faf115dfffaf12cdae98eac71fc6811059c6657.tar.gz tor-7faf115dfffaf12cdae98eac71fc6811059c6657.zip |
Change all SMARTLIST_FOREACH loops of >=10 lines to use BEGIN/END
The SMARTLIST_FOREACH macro is more convenient than BEGIN/END when
you have a nice short loop body, but using it for long bodies makes
your preprocessor tell the compiler that all the code is on the same
line. That causes grief, since compiler warnings and debugger lines
will all refer to that one line.
So, here's a new style rule: SMARTLIST_FOREACH blocks need to be
short.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 95101ef65d..364e4912da 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -706,8 +706,7 @@ connection_expire_held_open(void) now = time(NULL); - SMARTLIST_FOREACH(conns, connection_t *, conn, - { + SMARTLIST_FOREACH_BEGIN(conns, connection_t *, conn) { /* If we've been holding the connection open, but we haven't written * for 15 seconds... */ @@ -729,7 +728,7 @@ connection_expire_held_open(void) conn->hold_open_until_flushed = 0; } } - }); + } SMARTLIST_FOREACH_END(conn); } #if defined(HAVE_SYS_UN_H) || defined(RUNNING_DOXYGEN) @@ -2477,8 +2476,7 @@ connection_bucket_refill(int milliseconds_elapsed, time_t now) "global_relayed_write_bucket"); /* refill the per-connection buckets */ - SMARTLIST_FOREACH(conns, connection_t *, conn, - { + SMARTLIST_FOREACH_BEGIN(conns, connection_t *, conn) { if (connection_speaks_cells(conn)) { or_connection_t *or_conn = TO_OR_CONN(conn); int orbandwidthrate = or_conn->bandwidthrate; @@ -2525,7 +2523,7 @@ connection_bucket_refill(int milliseconds_elapsed, time_t now) conn->write_blocked_on_bw = 0; connection_start_writing(conn); } - }); + } SMARTLIST_FOREACH_END(conn); } /** Is the <b>bucket</b> for connection <b>conn</b> low enough that we @@ -3974,8 +3972,7 @@ connection_dump_buffer_mem_stats(int severity) memset(alloc_by_type, 0, sizeof(alloc_by_type)); memset(n_conns_by_type, 0, sizeof(n_conns_by_type)); - SMARTLIST_FOREACH(conns, connection_t *, c, - { + SMARTLIST_FOREACH_BEGIN(conns, connection_t *, c) { int tp = c->type; ++n_conns_by_type[tp]; if (c->inbuf) { @@ -3986,7 +3983,7 @@ connection_dump_buffer_mem_stats(int severity) used_by_type[tp] += buf_datalen(c->outbuf); alloc_by_type[tp] += buf_allocation(c->outbuf); } - }); + } SMARTLIST_FOREACH_END(c); for (i=0; i <= _CONN_TYPE_MAX; ++i) { total_used += used_by_type[i]; total_alloc += alloc_by_type[i]; |