commit 05194cce626ee40770ffa1772b78f2b728addf33 Author: Nick Mathewson nickm@torproject.org Date: Fri Nov 2 13:14:39 2012 -0400
Avoid c99 designated initializers in circuitmux_ewma.c
We still want to build on compilers w/o c99 support, such as (notoriously, shamefully) MSVC.
So I'm commenting out the designated initializers in circuitmux_ewma.c. The alternative would have been to use some kind of macros to use designated initializers only when they're supported, but that's error-prone, and can lead to code having different meanings under different compilers.
Bug 7286; fix on 0.2.4.4-alpha; spotted by Gisle Vanem. --- changes/ewma_policy_c99 | 3 +++ src/or/circuitmux_ewma.c | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/changes/ewma_policy_c99 b/changes/ewma_policy_c99 new file mode 100644 index 0000000..49177b3 --- /dev/null +++ b/changes/ewma_policy_c99 @@ -0,0 +1,3 @@ + o Minor bugfixes: + - Compile correctly on compilers without C99 designated initializer + support. Fixes bug 7286; bugfix on 0.2.4.4-alpha. diff --git a/src/or/circuitmux_ewma.c b/src/or/circuitmux_ewma.c index 97f007d..e1964d2 100644 --- a/src/or/circuitmux_ewma.c +++ b/src/or/circuitmux_ewma.c @@ -200,15 +200,16 @@ static int ewma_enabled = 0;
/*** EWMA circuitmux_policy_t method table ***/
-circuitmux_policy_t ewma_policy = { .alloc_cmux_data = ewma_alloc_cmux_data, - .free_cmux_data = ewma_free_cmux_data, - .alloc_circ_data = ewma_alloc_circ_data, - .free_circ_data = ewma_free_circ_data, - .notify_circ_active = ewma_notify_circ_active, - .notify_circ_inactive = ewma_notify_circ_inactive, - .notify_set_n_cells = NULL, /* EWMA doesn't need this */ - .notify_xmit_cells = ewma_notify_xmit_cells, - .pick_active_circuit = ewma_pick_active_circuit +circuitmux_policy_t ewma_policy = { + /*.alloc_cmux_data =*/ ewma_alloc_cmux_data, + /*.free_cmux_data =*/ ewma_free_cmux_data, + /*.alloc_circ_data =*/ ewma_alloc_circ_data, + /*.free_circ_data =*/ ewma_free_circ_data, + /*.notify_circ_active =*/ ewma_notify_circ_active, + /*.notify_circ_inactive =*/ ewma_notify_circ_inactive, + /*.notify_set_n_cells =*/ NULL, /* EWMA doesn't need this */ + /*.notify_xmit_cells =*/ ewma_notify_xmit_cells, + /*.pick_active_circuit =*/ ewma_pick_active_circuit };
/*** EWMA method implementations using the below EWMA helper functions ***/
tor-commits@lists.torproject.org