1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-04 22:21:55 +03:00
systemd/coccinelle/no-if-assignments.cocci
Lennart Poettering 3cc2aff1ab tree-wide: don't do assignments within if checks
Turn this:

       if ((r = foo()) < 0) { ...

into this:

       r = foo();
       if (r < 0) { ...
2015-09-09 08:20:20 +02:00

21 lines
200 B
Plaintext

@@
expression p, q;
identifier r;
statement s;
@@
- if ((r = q) < p)
- s
+ r = q;
+ if (r < p)
+ s
@@
expression p, q;
identifier r;
statement s;
@@
- if ((r = q) >= p)
- s
+ r = q;
+ if (r >= p)
+ s