[Cocci] Remove unnecessary null pointer checks?

SF Markus Elfring elfring at users.sourceforge.net
Wed Feb 26 09:04:19 CET 2014

> Remember that ... matches the shortest path between what is before and 
> what is after.  So if there is another if test on the same data in the 
> function, that will cause a failure.  If yo udon't care to have this 
> constraint, you can put when any on a ...

The following pattern variant does not show a different analysis result.

expression data;
identifier work;
identifier release =~ "^kz?free$";
position pos;
type t;
 t work at pos(...)
  ... when any
( if (data) release(data);
| if (likely(data)) release(data);
  ... when any


More information about the Cocci mailing list