From 56c7b01e163c233030359781d7e60f4553e90c51 Mon Sep 17 00:00:00 2001 From: Jon Loeliger Date: Wed, 1 Feb 2017 12:31:41 -0600 Subject: Refactor fragile msg macro W and W2 to not burry return control flow. Instead, have them accept and assign a return paramter leaving the return control flow up to the caller. Clean up otherwise misleading returns present even after "NOT REACHED" comments. Change-Id: I0861921f73ab65d55b95eabd27514f0129152723 Signed-off-by: Jon Loeliger --- src/plugins/lb/lb_test.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/plugins/lb/lb_test.c') diff --git a/src/plugins/lb/lb_test.c b/src/plugins/lb/lb_test.c index a811079e..9b30c18d 100644 --- a/src/plugins/lb/lb_test.c +++ b/src/plugins/lb/lb_test.c @@ -134,6 +134,7 @@ static int api_lb_conf (vat_main_t * vam) { unformat_input_t *i = vam->input; vl_api_lb_conf_t mps, *mp; + int ret; if (!unformat(i, "%U %U %u %u", unformat_ip4_address, &mps.ip4_src_address, @@ -146,16 +147,15 @@ static int api_lb_conf (vat_main_t * vam) M(LB_CONF, mp); S(mp); - W; - - /* NOTREACHED */ - return 0; + W (ret); + return ret; } static int api_lb_add_del_vip (vat_main_t * vam) { unformat_input_t * i = vam->input; vl_api_lb_add_del_vip_t mps, *mp; + int ret; mps.is_del = 0; mps.is_gre4 = 0; @@ -185,15 +185,15 @@ static int api_lb_add_del_vip (vat_main_t * vam) M(LB_ADD_DEL_VIP, mp); S(mp); - W; - /* NOTREACHED */ - return 0; + W (ret); + return ret; } static int api_lb_add_del_as (vat_main_t * vam) { unformat_input_t * i = vam->input; vl_api_lb_add_del_as_t mps, *mp; + int ret; mps.is_del = 0; if (!unformat(i, "%U %U", @@ -209,9 +209,8 @@ static int api_lb_add_del_as (vat_main_t * vam) M(LB_ADD_DEL_AS, mp); S(mp); - W; - /* NOTREACHED */ - return 0; + W (ret); + return ret; } /* -- cgit 1.2.3-korg