Re: [PATCH 3/5] ipset: coalesce two ifs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 8 Sep 2014, Holger Eitzenberger wrote:

> Because they are doing the same for both IPSET_CMD_LIST and
> IPSET_CMD_SAVE.
> 
> Signed-off-by: Holger Eitzenberger <holger@xxxxxxxxxxxxxxxx>
> ---
>  lib/session.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/session.c b/lib/session.c
> index 7a719b2..d4fe836 100644
> --- a/lib/session.c
> +++ b/lib/session.c
> @@ -1936,13 +1936,11 @@ ipset_cmd(struct ipset_session *session, enum ipset_cmd cmd, uint32_t lineno)
>  	session->lineno = lineno;
>  
>  	/* Set default output mode */
> -	if (cmd == IPSET_CMD_LIST) {
> +	if (cmd == IPSET_CMD_LIST || cmd == IPSET_CMD_SAVE) {
>  		if (session->mode == IPSET_LIST_NONE)
>  			session->mode = IPSET_LIST_PLAIN;
> -	} else if (cmd == IPSET_CMD_SAVE) {
> -		if (session->mode == IPSET_LIST_NONE)
> -			session->mode = IPSET_LIST_SAVE;
>  	}
> +
>  	/* Start the root element in XML mode */
>  	if ((cmd == IPSET_CMD_LIST || cmd == IPSET_CMD_SAVE) &&
>  	    session->mode == IPSET_LIST_XML)
> 

The two ifs don't do the same thing: by coalescing them the safe mode 
would be broken (unless XML mode is specified). So this patch is skipped.

Best regards,
Jozsef
-
E-mail  : kadlec@xxxxxxxxxxxxxxxxx, kadlecsik.jozsef@xxxxxxxxxxxxx
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
          H-1525 Budapest 114, POB. 49, Hungary
--
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




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux