On Tue, 2011-06-07 at 07:42 +0200, Julia Lawall wrote:
> On Mon, 6 Jun 2011, Joe Perches wrote:
> > Cocci already handles the parens case
> > "(foo->end-foo->start)+1"
> If you put parentheses, it will consider removing them.  But I don't think 
> it would go the other way around.

It does.

$ spatch -very_quiet -sp_file resource.cocci t2.c
--- t2.c        2011-06-07 00:37:48.000000000 -0700
+++ /tmp/cocci-output-3529-9bb101-t2.c  2011-06-07 00:38:31.000000000
-0700
@@ -12,7 +12,7 @@ void test_resource(void)
 {
        int i;
        for (i = 0; i < ARRAY_SIZE(array); i++) {
-               if ((p[i].end - p[i].start) + 1 > 0x12345)
+               if (resource_size(p) > 0x12345)
                        printk(KERN_CRIT "Some failure\n");
        }
 }


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

Reply via email to