One more question - can I write more general rule for all functions
ending with malloc?
Something like that was not working:
@@
type T;
identifier malloc ~= ".*malloc";
T *x;
@@
- malloc (x)
+ malloc (*(x))
I managed to get the following working:
@@
identifier malloc =~ "malloc$";
@@
malloc(
- x
+ *(x)
)
With malloc removed and added back, it doesn't work though, at least not
with PCRE regular expressions. There is some test with = that is invalid
in this case.
Note that by default, a regular expression matches anywhere in the middle
of a string. So putting .* at the beginning is not needed.
julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)