Greg,

I'm on vacation, so this is more for fun and also so that I can learn
more about Coccinelle :) You are right though... and your reasoning is
also why I've been leaving these cases alone to date. If I do tackle
this problem, it will be more for the academic challenge than anything
else.

More common patterns that can be replaced by a single statement are:

if (foo) return 1; // or TRUE
return 0; // or FALSE

and perhaps:

if (bar) return x+1;
return x;

Sometimes an else is involved in the above.

--
Derek M. Jones                         tel: +44 (0) 1252 520 667
Knowledge Software Ltd                 mailto:[email protected]
Source code analysis                   http://www.knosof.co.uk
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to