diff options
author | Harsha Sharma <harshasharmaiitr@gmail.com> | 2017-09-27 17:14:52 +0530 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-10-04 15:54:00 +0200 |
commit | f5b46c2f0aa6ee4eed107aca5561c24a16534b7f (patch) | |
tree | 1fcee1d26a2ef08701c2402d11fc6e2f2d501e02 /iptables/xtables.c | |
parent | 21ba5b3874fb3d0c4cccc9b59f65c8df575211e2 (diff) |
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 <harshasharmaiitr@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables/xtables.c')
-rw-r--r-- | iptables/xtables.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/iptables/xtables.c b/iptables/xtables.c index ac113254..aebe7d77 100644 --- a/iptables/xtables.c +++ b/iptables/xtables.c @@ -59,7 +59,7 @@ static const char cmdflags[] = { 'I', 'D', 'D', 'R', 'A', 'L', 'F', 'Z', static const char optflags[] = { 'n', 's', 'd', 'p', 'j', 'v', 'x', 'i', 'o', '0', 'c', 'f'}; -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'}, |