summaryrefslogtreecommitdiff
path: root/coccinelle/systemd-definitions.iso
blob: 92db763a29f7e4e88790be08a4ae40687a849765 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* Statement isomorphisms - replace explicit checks against NULL with a
 * shorter variant, which relies on C's downgrade-to-bool feature.
 * The expression metavariables should be declared as pointers, however,
 * that doesn't work well with complex expressions like:
 * if (UNIT(p)->default_dependencies != NULL)
 */

Statement
@@
expression X;
statement S;
@@
if (X == NULL) S => if (!X) S

Statement
@@
expression X;
statement S;
@@
if (X != NULL) S => if (X) S