All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ip_tables.h: Add the const qualifier.
@ 2011-09-28  7:32 ` Il Han
  0 siblings, 0 replies; 3+ messages in thread
From: Il Han @ 2011-09-28  7:32 UTC (permalink / raw)
  To: David S. Miller, Rusty Russell, James Morris, Harald Welte,
	Jozsef Kadlecsik
  Cc: netfilter-devel, netfilter, coreteam, 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

Add it.

Signed-off-by: Il Han <corone.il.han@gmail.com>
---
 include/linux/netfilter_ipv4/ip_tables.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 64a5d95..6e319f4 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -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;
 }
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] ip_tables.h: Add the const qualifier.
@ 2011-09-28  7:32 ` Il Han
  0 siblings, 0 replies; 3+ messages in thread
From: Il Han @ 2011-09-28  7:32 UTC (permalink / raw)
  To: David S. Miller, Rusty Russell, James Morris, Harald Welte,
	Jozsef Kadlecsik
  Cc: netfilter-devel, netfilter, coreteam, 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

Add it.

Signed-off-by: Il Han <corone.il.han@gmail.com>
---
 include/linux/netfilter_ipv4/ip_tables.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 64a5d95..6e319f4 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -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;
 }
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ip_tables.h: Add the const qualifier.
  2011-09-28  7:32 ` Il Han
  (?)
@ 2011-09-28 12:16 ` Jan Engelhardt
  -1 siblings, 0 replies; 3+ messages in thread
From: Jan Engelhardt @ 2011-09-28 12:16 UTC (permalink / raw)
  To: Il Han
  Cc: David S. Miller, Rusty Russell, James Morris, Harald Welte,
	Jozsef Kadlecsik, Patrick McHardy, netfilter-devel, netfilter,
	coreteam

On Wednesday 2011-09-28 09:32, Il Han wrote:

>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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-09-28 12:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-28  7:32 [PATCH] ip_tables.h: Add the const qualifier Il Han
2011-09-28  7:32 ` Il Han
2011-09-28 12:16 ` Jan Engelhardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.