On Mon, 6 Jun 2011, Joe Perches wrote:

> On Tue, 2011-06-07 at 07:07 +0200, Julia Lawall wrote:
> > On Mon, 6 Jun 2011, Joe Perches wrote:
> > > Perhaps do a treewide update via:
> > > $ cat resource.cocci
> > > @@
> > > struct resource *ptr;
> > > @@
> > > - ptr->end - ptr->start + 1
> > > + resource_size(ptr)
> > > $ spatch -sp_file resource.cocci linux-2.6/
> > There might be some cases that have the +1 in a different place, or that 
> > have some parentheses.
> > I suspect that a lot of these non-uses of resource_size still exist.
> 
> True enough.
> 
> 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.

julia

> There are some uses of end+1-start and
> 1+end-start that weren't converted by
> the patch I sent.

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

Reply via email to