ip_tables.h: Add the const qualifier.
PATCH 1/1 ip_tables.h: Add the const qualifier.
We need to add the const qualifier before the struct specifier, because its value will not be changed.
Then, the following warning would be removed.
net/ipv4/netfilter/ip_tables.c:183: warning: passing argument 1 of 'ipt_get_target' discards qualifiers from pointer target type
Add it.
--- include/linux/netfilter_ipv4/ip_tables.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/netfilter_ipv4/ip_tables.h +1 -1
@@ -224,7 +224,7 @@ struct ipt_get_entries {/* Helper functions */ static __inline__struct xt_entry_target * -ipt_get_target (struct ipt_entry *e) +ipt_get_target (const struct ipt_entry *e) {return (void *)e + e->target_offset; }
Signature · 1 line
1.7.4.1
Quoted 6 lines · Il Han
We need to add the const qualifier before the struct specifier, because its value will not be changed.
Then, the following warning would be removed.
net/ipv4/netfilter/ip_tables.c:183: warning: passing argument 1 of 'ipt_get_target' discards qualifiers from pointer target type
gcc-4.6.1_20110801 does not output any such warning - which also seems to be correct, since line 183 reads:
return ipt_get_target((struct ipt_entry *)e);
So in ipt_get_target_c, we already do away with the const qualifier before calling ipt_get_target.