1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00
systemd/coccinelle/equals-null.cocci
Frantisek Sumsal 473de9b708 coccinelle: fix the equals-null transformation
The original issue with this transformation was that we were replacing
the whole if statement instead of just the expression inside. That
caused the code to be weirdly formatted, as Coccinelle put a new block
around each replaced if statement.

This version replaces just the inner expression if it's in its incorrect
form, otherwise it just accepts it (to avoid recursion).
2020-10-04 12:32:21 +02:00

30 lines
169 B
Plaintext

@@
expression e;
statement s;
@@
if (
(
!e
|
- e == NULL
+ !e
)
)
{...}
else s
@@
expression e;
statement s;
@@
if (
(
e
|
- e != NULL
+ e
)
)
{...}
else s