summaryrefslogtreecommitdiffstats
path: root/src/plugins/lb/lb_test.c
diff options
context:
space:
mode:
authorJon Loeliger <jdl@netgate.com>2017-02-01 12:31:41 -0600
committerDave Barach <openvpp@barachs.net>2017-02-02 17:32:27 +0000
commit56c7b01e163c233030359781d7e60f4553e90c51 (patch)
tree6d6ce1f179fdbfa2c2919ac082984fd0bf426f7f /src/plugins/lb/lb_test.c
parent1f9191f6efa5f2e0284c194f920093201b27ef81 (diff)
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 <jdl@netgate.com>
Diffstat (limited to 'src/plugins/lb/lb_test.c')
-rw-r--r--src/plugins/lb/lb_test.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/plugins/lb/lb_test.c b/src/plugins/lb/lb_test.c
index a811079ea75..9b30c18d459 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;
}
/*