Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1699084
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 0/2] constify inet6_protocol structures |
| Date | 2017-07-28 22:50 +0200 |
| Message-ID | <u8kmS-er-37@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
The inet6_protocol structure is only passed as the first argument to
inet6_add_protocol or inet6_del_protocol, both of which are declared as
const. Thus the inet6_protocol structure itself can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct inet6_protocol i@p = { ... };
@ok1@
identifier r.i;
expression e1;
position p;
@@
\(inet6_add_protocol\|inet6_del_protocol\)(&i@p,...)
@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct inet6_protocol e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct inet6_protocol i = { ... };
// </smpl>
---
net/ipv6/ip6_gre.c | 2 +-
net/ipv6/tcp_ipv6.c | 2 +-
net/ipv6/udp.c | 2 +-
net/l2tp/l2tp_ip6.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 0/2] constify inet6_protocol structures Julia Lawall <Julia.Lawall@lip6.fr> - 2017-07-28 22:50 +0200 [PATCH 1/2] ipv6: constify inet6_protocol structures Julia Lawall <Julia.Lawall@lip6.fr> - 2017-07-28 22:50 +0200 Re: [PATCH 0/2] constify inet6_protocol structures David Miller <davem@davemloft.net> - 2017-07-29 04:00 +0200
csiph-web