Skip to content

Commit a2b0fe7

Browse files
JuliaLawallmasahir0y
authored andcommitted
coccinelle: deref_null: avoid useless computation
The effect of the rules ifm1, pr11, and pr12 is only used in the final rule, which depends on context && !org && !report. Thus these rules should only be performed in those circumstances. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
1 parent e856f3a commit a2b0fe7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎scripts/coccinelle/null/deref_null.cocci‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,23 +212,23 @@ else S3
212212
// The following three rules are duplicates of ifm, pr1 and pr2 respectively.
213213
// It is need because the previous rule as already made a "change".
214214

215-
@ifm1@
215+
@ifm1 depends on context && !org && !report@
216216
expression *E;
217217
statement S1,S2;
218218
position p1;
219219
@@
220220

221221
if@p1 ((E == NULL && ...) || ...) S1 else S2
222222

223-
@pr11 expression@
223+
@pr11 depends on context && !org && !report expression@
224224
expression *ifm1.E;
225225
identifier f;
226226
position p1;
227227
@@
228228

229229
(E != NULL && ...) ? <+...E->f@p1...+> : ...
230230

231-
@pr12 expression@
231+
@pr12 depends on context && !org && !report expression@
232232
expression *ifm1.E;
233233
identifier f;
234234
position p2;

0 commit comments

Comments
 (0)