Thanks for your interest in Coccinelle. I had thought that in te 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. julia On Wed, 24 Nov 2010, Eric Leblond wrote: > Hi, > > First of all thanks for coccinnelle. This is a really powerful tool. > > I'm a complete beginner and I'm trying to use coccinnelle to do a > massive patch on a software (suricata, see > http://www.openinfosecfoundation.org/). My goal is to replace TYPE p by > TYPE *p and to automagically do the needed change in the source. > > I've almost managed to do it. It is correct for almost all my files. But > I encounter the following problem: > Fatal error: exception Failure("More that one variable in decl. Have to > split to transform.") > > This is due to the fact that the code contains: > TYPE p1, p2; > > How do I handle this. > > My cocci file looks like the following: > @rule1@ > identifier p; > identifier func; > identifier fdl; > @@ > func(...) { > ... > Packet p; > <... > ( > - p.fdl > + p->fdl > | > - &p > + p > ) > ...> > } > > > @rule2@ > identifier p; > identifier func; > @@ > func(...) { > ... > - Packet p; > + Packet *p = SCMalloc(SIZE_OF_PACKET); > + if (p == NULL) > + return 0; > ... > + SCFree(p); > return ...; > } > > -- > Eric Leblond > > _______________________________________________ > Cocci mailing list > [email protected] > http://lists.diku.dk/mailman/listinfo/cocci > (Web access from inside DIKUs LAN only) > _______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
