Re: [PATCH 6/6] netfilter: xtables: add const qualifiers

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

 



Alexey Dobriyan wrote:
>> -static inline int ebt_basic_match(struct ebt_entry *e, struct ethhdr *h,
>> -   const struct net_device *in, const struct net_device *out)
>> +static inline int
>> +ebt_basic_match(const struct ebt_entry *e, const struct ethhdr *h,
>> +                const struct net_device *in, const struct net_device *out)
> 
> These const modifiers are pointless because compilers are smart enough
> to notice non-modifiability and generate the very same code in both cases.
> 
> Nowadays, half of functions declarations in generic
> xtables/iptables/ip6tables/arptables
> code are littered with const which makes them pretty unpleasant to read.

Well, the benefit is that the compiler can catch accidental modification
of data that is supposed to be constant.

> 
>> -	struct ebt_entry *e = (struct ebt_entry *)chain->data;
>> +	const struct ebt_entry *e = (struct ebt_entry *)chain->data;
> 
> And such things are wrong (not second const).

What's wrong about this?
--
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