Use switch instead of if branch. Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> --- src/expr/numgen.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/expr/numgen.c b/src/expr/numgen.c index 0981d72..7be8270 100644 --- a/src/expr/numgen.c +++ b/src/expr/numgen.c @@ -189,16 +189,17 @@ nftnl_expr_ng_snprintf_default(char *buf, size_t size, struct nftnl_expr_ng *ng = nftnl_expr_data(e); int len = size, offset = 0, ret; - if (ng->type == NFT_NG_INCREMENTAL) { + switch (ng->type) { + case NFT_NG_INCREMENTAL: ret = snprintf(buf, len, "reg %u = inc(%u)", ng->dreg, ng->until); SNPRINTF_BUFFER_SIZE(ret, size, len, offset); - } - - if (ng->type == NFT_NG_RANDOM) { + break; + case NFT_NG_RANDOM: ret = snprintf(buf, len, "reg %u = random(%u)", ng->dreg, ng->until); SNPRINTF_BUFFER_SIZE(ret, size, len, offset); + break; } return offset; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html