On Sun, 29 May 2011, Francis Galiegue wrote:

> Hello,
> 
> Here is a semantic patch:
> 
> ----
> @r exists@
> identifier fn;
> expression r;
> @@
> 
> fn(...)
> {
> ...
> r = newvstralloc(r, ...)
> ... when any
> }
> 
> @t1@
> identifier r.fn;
> expression x, e1;
> @@
> 
> fn(...)
> {
> + char *tmp;
> <...
> - x = newvstralloc(x, e1
> + tmp = g_strconcat(e1
>   , ...);
> + g_free(x);
> + x = tmp;
> ...>
> }
> ----
> 
> It works fine... Except that it won't substitute, for instance, in this case:
> 
> ----
>     if (pkt->type != P_REP) {
>         errstr = newvstrallocf(errstr, _("received strange packet type %s: 
> %s"),

It's quite hard to see, but the function is not the same here.  Here there 
is newvstrallocf, with an f at the end.

julia

>                               pkt_type2str(pkt->type), pkt->body);
>         *response_error = 1;
>         return;
>     }
> ----
> 
> The only difference between this place (and two others) is the return.
> What is missing to the above patch to also catch these cases?
> 
> -- 
> Francis Galiegue, [email protected]
> "It seems obvious [...] that at least some 'business intelligence'
> tools invest so much intelligence on the business side that they have
> nothing left for generating SQL queries" (Stéphane Faroult, in "The
> Art of SQL", ISBN 0-596-00894-5)
> _______________________________________________
> 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)

Reply via email to