mirror of
https://github.com/systemd/systemd.git
synced 2024-10-26 17:27:41 +03:00
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).
This commit is contained in:
parent
3bc3c734c6
commit
473de9b708
@ -2,13 +2,28 @@
|
||||
expression e;
|
||||
statement s;
|
||||
@@
|
||||
- if (e == NULL)
|
||||
+ if (!e)
|
||||
s
|
||||
if (
|
||||
(
|
||||
!e
|
||||
|
|
||||
- e == NULL
|
||||
+ !e
|
||||
)
|
||||
)
|
||||
{...}
|
||||
else s
|
||||
|
||||
@@
|
||||
expression e;
|
||||
statement s;
|
||||
@@
|
||||
- if (e != NULL)
|
||||
+ if (e)
|
||||
s
|
||||
if (
|
||||
(
|
||||
e
|
||||
|
|
||||
- e != NULL
|
||||
+ e
|
||||
)
|
||||
)
|
||||
{...}
|
||||
else s
|
||||
|
Loading…
Reference in New Issue
Block a user