Re: [PATCH nf-next] netfilter: xt_nfacct: Use not operation instead of condition check

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

 



Gao Feng <fgao@xxxxxxxxxx> wrote:
> >> diff --git a/net/netfilter/xt_nfacct.c b/net/netfilter/xt_nfacct.c
> >> index cf32759..7abb5b5 100644
> >> --- a/net/netfilter/xt_nfacct.c
> >> +++ b/net/netfilter/xt_nfacct.c
> >> @@ -28,7 +28,7 @@ static bool nfacct_mt(const struct sk_buff *skb, struct xt_action_param *par)
> >>
> >>       overquota = nfnl_acct_overquota(par->net, skb, info->nfacct);
> >>
> >> -     return overquota == NFACCT_UNDERQUOTA ? false : true;
> >> +     return !(overquota == NFACCT_UNDERQUOTA);
> >
> > I don't find one better than the other.  If you need to change
> > it for some reason consider
> >
> > "return overquota != NFACCT_UNDERQUOTA"
> >
> > instead of this strange negation.
> 
> Thanks, it is more simple use "!=".
> >
> > But really, I think its fine as-is.
> 
> It could decrease one condition check and jump.

gcc should emit same instructions for all these variants.
--
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