On Thu, 19 May 2011, Francis Galiegue wrote:

> On Thu, May 19, 2011 at 15:44, Julia Lawall <[email protected]> wrote:
> > Sorry.  name is a reserved word.  Change the two occurrences eg to nm.
> >
> 
> Yes, that worked! However, the constant was surrounded with quotes, so
> I had to do a little more manipulations... Here is the final result:

OK, good point :)

julia

> ----
> @initialize:python@
> 
> import re
> 
> @case2@
> constant char [] c;
> expression e;
> position p;
> @@
> 
> stralloc2@p(c, e)
> 
> @script:python nm@
> c << case2.c;
> c2;
> newc;
> @@
> 
> c2 = "%s" % c
> c2 = re.sub(r'^"', r'', c2)
> c2 = re.sub(r'"$', r'', c2)
> coccinelle.newc = "\"%s%%s\"" % c2
> 
> @@
> position case2.p;
> identifier nm.newc;
> expression e1,e2;
> @@
> 
> - stralloc2@p(e1,e2)
> + g_strdup_printf(newc, e2)
> 
> ----
> 
> Thanks!
> -- 
> 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)

Reply via email to