Do you really need to use regular expressions in all of these cases? If you don't need to use regular expressions, then it is better to avoid them. Normally, if you have some function names in your semantic patch, and they are essential for the semantic patch to apply, Coccinelle will be applied to only files that contain these function names. With regular expressions, it does not do this optimization.

If you want to see what it is filtering on, you can run spatch -parse_cocci file.cocci, and the list of required words appears at the end of the output.

julia

Btw.
please note that calloc and realloc have different number and type of arguments.

I've created something like that for them:
@@
type T;
identifier malloc =~ "malloc$";
T *x;
@@

malloc(
-  x
+  *(x)
)

@@
type T2, T3;
identifier calloc =~ "calloc$";
T2 *y;
T3 *z;
@@

calloc(
-  y
+  *(y)
,
- z
+ *(z)
)

@@
type T4;
identifier realloc =~ "realloc$";
T4 *w;
@@

realloc( ... ,
-  w
+  *(w)
)


I guess it might be simplified, but that's enough for my purposes.

Best regards,
Robert
_______________________________________________
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