DEV: coccinelle: add cs_endp_flags.cocci

This one turns the various forms of "cs->endp->flags <op> value" to
their sc_ep_<op>(cs) equivalent.
This commit is contained in:
Willy Tarreau 2022-05-17 16:08:36 +02:00
parent cd1d585e53
commit 87b60b2c9d
1 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,76 @@
@@
struct conn_stream *cs;
expression e;
@@
(
- (cs->endp->flags & (e))
+ sc_ep_test(cs, e)
|
- (cs->endp->flags & e)
+ sc_ep_test(cs, e)
|
- cs->endp->flags & (e)
+ sc_ep_test(cs, e)
|
- cs->endp->flags & e
+ sc_ep_test(cs, e)
)
@@
struct conn_stream *cs;
expression e;
@@
(
- cs->endp->flags |= (e)
+ sc_ep_set(cs, e)
|
- cs->endp->flags |= e
+ sc_ep_set(cs, e)
)
@@
struct conn_stream *cs;
expression e;
@@
(
- cs->endp->flags &= ~(e)
+ sc_ep_clr(cs, e)
|
- cs->endp->flags &= (e)
+ sc_ep_clr(cs, ~e)
|
- cs->endp->flags &= ~e
+ sc_ep_clr(cs, e)
|
- cs->endp->flags &= e
+ sc_ep_clr(cs, ~e)
)
@@
struct conn_stream *cs;
@@
- cs->endp->flags = 0
+ sc_ep_zero(cs)
@@
struct conn_stream *cs;
expression e;
@@
(
- cs->endp->flags = (e)
+ sc_ep_setall(cs, e)
|
- cs->endp->flags = e
+ sc_ep_setall(cs, e)
)
@@
struct conn_stream *cs;
@@
(
- (cs->endp->flags)
+ sc_ep_get(cs)
|
- cs->endp->flags
+ sc_ep_get(cs)
)