From f5b46c2f0aa6ee4eed107aca5561c24a16534b7f Mon Sep 17 00:00:00 2001 From: Harsha Sharma Date: Wed, 27 Sep 2017 17:14:52 +0530 Subject: iptables: Constify option struct The struct of type option is only used to initialise a field inside the xtables_globals struct and is not modified anywhere. Done using following coccinelle semantic patch @r1 disable optional_qualifier@ identifier s,i; position p; @@ static struct option i@p[] ={...}; @ok1@ identifier r1.i; expression e; position p; @@ e = i@p @bad@ position p != {r1.p,ok1.p}; identifier r1.i; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ static +const struct option i[] = { ... }; Signed-off-by: Harsha Sharma Signed-off-by: Pablo Neira Ayuso --- iptables/iptables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'iptables/iptables.c') diff --git a/iptables/iptables.c b/iptables/iptables.c index 69d19fec..e930fe26 100644 --- a/iptables/iptables.c +++ b/iptables/iptables.c @@ -75,7 +75,7 @@ static const char optflags[] static const char unsupported_rev[] = " [unsupported revision]"; -static struct option original_opts[] = { +static const struct option original_opts[] = { {.name = "append", .has_arg = 1, .val = 'A'}, {.name = "delete", .has_arg = 1, .val = 'D'}, {.name = "check", .has_arg = 1, .val = 'C'}, -- cgit v1.2.3