Hi,

I'm quite new to Coccinelle but it seems to be an excellent tool,
however, I have a question about how to use it to do what I need.

I have a bunch of code that looks like this (inside a function):

xFoobarReply foobar;
/* many lines of code */
WriteToClient(client, sizeof(xFoobarReply), &foobar);

I would like to transform these into (note change of foobar to rep):

REPLY(xFoobarReply);
/* many lines of code */
WriteToClient(client, sizeof(xFoobarReply), &rep);

Then the REPLY macro is defined to expand to:
xFoobarReply rep; memset(&rep, 0, sizeof(xFoobarReply);

But note that I must only match on calls to WriteToClient. I know how I
could change the WriteToClient line easily, but not how to change the
declaration of one of it's arguments?

Thanks for any help!
--
Oliver McFadden.

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

Reply via email to