Hi,

Le jeudi 25 novembre 2010 à 18:55 +0100, Julia Lawall a écrit :
> On Wed, 24 Nov 2010, Julia Lawall wrote:
> 
> > Thanks for your interest in Coccinelle.  I had thought that in the special 
> > case where the change is only on the variable that it would be able to 
> > make the transformation.  Ie, if the second rule were rather written with:
> > 
> >   Packet
> > - p
> > + *p = SCMalloc(SIZE_OF_PACKET)
> >   ;
> > 
> > But I see that this is not working either.  I will look into it and hope 
> > to find a solution today or tomorrow.
> 
> It turned out to be a little more subtle than expected.  I will hope to 
> have a working solution soon.

Working on the same code modification, I did not found a way to treat
the case where I've got multiple Packet variable.

If I use : 
        @rule1@
        identifier p;
        identifier func;
        identifier fdl;
        @@
        func(...) {
        ...
        Packet p;
        <...
        (
        - p.fdl
        + p->fdl
        |
        - &(p)
        + p
        )
        ...>
        }

on a file where there is :
        Packet p1;
        Packet p2;

then the modification is only done on p1.

Is there a way to treat all variables at once ?

BR,
--
Eric Leblond <[email protected]>

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

Reply via email to