[Cocci] Remove unnecessary null pointer checks?
SF Markus Elfring
elfring at users.sourceforge.net
Tue Feb 25 10:10:48 CET 2014
>> This example does not fit to my expectation because it seems that the function
>> implementation does not refer to the passed values.
I'm sorry that I overlooked information somehow there.
The implementations of the function "show_stack" can be nice source code
examples for further fine-tuning of proposed filter patterns.
Its interface contains two pointer parameters.
> I'm not sure what is the point of the if (input) is else es pattern.
I can also adjust the search approach like the following.
identifier work, input;
statement is, es;
void work at pos(...,data_type input,...)
( if (input) is
| if (likely(input)) is
> I would think you only want to find cases where the function does nothing
> until it tests input and aborts the function is the value is 0.
I guess that the interpretation of "nothing relevant" will need further
considerations, won't it?
> So you only want the return case.
Not "only" this one ...
I have got a feeling for a need to introspect the else branch for useful
properties. I am unsure about better analysis of the metavariable "es" with the
semantic patch language.
More information about the Cocci