]> git.ipfire.org Git - thirdparty/iptables.git/commit
iptables: Constify option struct
authorHarsha Sharma <harshasharmaiitr@gmail.com>
Wed, 27 Sep 2017 11:44:52 +0000 (17:14 +0530)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 4 Oct 2017 13:54:00 +0000 (15:54 +0200)
commitf5b46c2f0aa6ee4eed107aca5561c24a16534b7f
tree1fcee1d26a2ef08701c2402d11fc6e2f2d501e02
parent21ba5b3874fb3d0c4cccc9b59f65c8df575211e2
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>
iptables/ip6tables.c
iptables/iptables.c
iptables/xtables-eb.c
iptables/xtables.c