From b2c31b685fd2cf28436ca32bc93e23eb24c74878 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Sun, 13 Dec 2020 21:47:40 +0100 Subject: misc: move to new pool_foreach macros Type: refactor Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772 Signed-off-by: Damjan Marion --- src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c | 10 ++++----- src/plugins/nsh/nsh_api.c | 20 ++++++++---------- src/plugins/nsh/nsh_cli.c | 32 +++++++++++------------------ 3 files changed, 24 insertions(+), 38 deletions(-) (limited to 'src/plugins/nsh') diff --git a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c index 57e5e6cfa39..63e6a98fe27 100644 --- a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c +++ b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c @@ -64,11 +64,11 @@ nsh_md2_ioam_clear_output_feature_on_all_intfs (vlib_main_t * vm) vnet_main_t *vnm = vnet_get_main (); vnet_interface_main_t *im = &vnm->interface_main; - pool_foreach (si, im->sw_interfaces, ( + pool_foreach (si, im->sw_interfaces) { nsh_md2_ioam_set_clear_output_feature_on_intf (vm, si->sw_if_index, 0); - })); + } return; } @@ -305,7 +305,7 @@ nsh_md2_ioam_refresh_output_feature_on_all_dest (void) i = vec_len (hm->bool_ref_by_sw_if_index); vec_free (hm->bool_ref_by_sw_if_index); vec_validate_init_empty (hm->bool_ref_by_sw_if_index, i, ~0); - pool_foreach (t, hm->dst_tunnels, ( + pool_foreach (t, hm->dst_tunnels) { nsh_md2_ioam_enable_disable_for_dest (gm->vlib_main, @@ -315,7 +315,6 @@ nsh_md2_ioam_refresh_output_feature_on_all_dest (void) /* is_add */ ); } - )); return; } @@ -382,7 +381,7 @@ int nsh_md2_ioam_disable_for_dest return 0; } - pool_foreach (t, hm->dst_tunnels, ( + pool_foreach (t, hm->dst_tunnels) { nsh_md2_ioam_enable_disable_for_dest (gm->vlib_main, @@ -391,7 +390,6 @@ int nsh_md2_ioam_disable_for_dest (t->fp_proto == FIB_PROTOCOL_IP4), 1 /* is_add */ ); } - )); nsh_md2_ioam_clear_output_feature_on_select_intfs (); return (0); diff --git a/src/plugins/nsh/nsh_api.c b/src/plugins/nsh/nsh_api.c index 2f40f31e62d..143285e3a3b 100644 --- a/src/plugins/nsh/nsh_api.c +++ b/src/plugins/nsh/nsh_api.c @@ -189,12 +189,10 @@ vl_api_nsh_map_dump_t_handler (vl_api_nsh_map_dump_t * mp) if (~0 == map_index) { - pool_foreach (t, nm->nsh_mappings, ( - { - send_nsh_map_details (t, rp, - mp->context); - } - )); + pool_foreach (t, nm->nsh_mappings) + { + send_nsh_map_details (t, rp, mp->context); + } } else { @@ -652,12 +650,10 @@ vl_api_nsh_entry_dump_t_handler (vl_api_nsh_entry_dump_t * mp) if (~0 == entry_index) { - pool_foreach (t, nm->nsh_entries, ( - { - send_nsh_entry_details (t, rp, - mp->context); - } - )); + pool_foreach (t, nm->nsh_entries) + { + send_nsh_entry_details (t, rp, mp->context); + } } else { diff --git a/src/plugins/nsh/nsh_cli.c b/src/plugins/nsh/nsh_cli.c index 8bebb7220c4..7bcaf1c51ad 100644 --- a/src/plugins/nsh/nsh_cli.c +++ b/src/plugins/nsh/nsh_cli.c @@ -141,13 +141,13 @@ nsh_get_adj_by_sw_if_index (u32 sw_if_index) adj_index_t ai = ~0; /* *INDENT-OFF* */ - pool_foreach_index(ai, adj_pool, - ({ + pool_foreach_index (ai, adj_pool) + { if (sw_if_index == adj_get_sw_if_index(ai)) { return ai; } - })); + } /* *INDENT-ON* */ return ~0; @@ -314,13 +314,10 @@ show_nsh_map_command_fn (vlib_main_t * vm, if (pool_elts (nm->nsh_mappings) == 0) vlib_cli_output (vm, "No nsh maps configured."); - pool_foreach (map, nm->nsh_mappings, ( - { - vlib_cli_output (vm, "%U", - format_nsh_map, - map); - } - )); + pool_foreach (map, nm->nsh_mappings) + { + vlib_cli_output (vm, "%U", format_nsh_map, map); + } return 0; } @@ -615,16 +612,11 @@ show_nsh_entry_command_fn (vlib_main_t * vm, if (pool_elts (nm->nsh_entries) == 0) vlib_cli_output (vm, "No nsh entries configured."); - pool_foreach (nsh_entry, nm->nsh_entries, ( - { - vlib_cli_output (vm, "%U", - format_nsh_header, - nsh_entry->rewrite); - vlib_cli_output (vm, - " rewrite_size: %d bytes", - nsh_entry->rewrite_size); - } - )); + pool_foreach (nsh_entry, nm->nsh_entries) + { + vlib_cli_output (vm, "%U", format_nsh_header, nsh_entry->rewrite); + vlib_cli_output (vm, " rewrite_size: %d bytes", nsh_entry->rewrite_size); + } return 0; } -- cgit 1.2.3-korg