Hi Derek :)

On 06/13/2011 05:38 PM, Derek M Jones wrote:
Greg,

1) sometimes you see this type of code - which i've chosen to ignore for
now:
if ((ret=XXXXX) < 0)
return ret;
return ret;

I'm surprised you are interested in special casing what is already
a relatively rare special case. Of the 17 instances of

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.

Greg

if (cond) return ret; return ret;
I have found 50% of them included a function call in cond.

I would be more inclined to flag this usage as being suspicious
rather than converting it to a single return.

_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to