[Cocci] Remove unnecessary null pointer checks?
julia.lawall at lip6.fr
Sun Feb 23 17:42:26 CET 2014
> > You may also want to specify that input has pointer type, since you are
> > actually looking for NULL tests, not zero tests.
> This is an important implementation detail which I would like to generalise so
> that also functions like "btrfsic_process_written_block" will be safely found by
> further source code searches.
> This one was found by the previous simple pattern for example despite I expected
> it to handle primarily pointer data types instead of an "unsigned int" in this case.
As you like. As a general principle, I think it is better to work on
fewer things at once. There are many reason why values may be null or 0,
and if you lump too many of them together, you will end up with more
information than is manageable. No bugs are involved here, you are only
making the code simpler, and if you miss some possibilities for making the
code simpler, it doesn't matter. You can just work on them later.
More information about the Cocci