I want to match
*ptr=value;
in a C code and then replace it by
CHECK_PTR(ptr)
*ptr=value;
CHECK_PTR() is a macro that check if ptr is not null
I write a Coccinelle script to do the work
@rule1@
type T;
T* ptr;
expression E;
@@
-\*ptr=E;
+CHECK_PTR(ptr)
+*ptr=E;
But this doesn't work because of the star operator. Here i used the backslash to escape the * however this didn't give any result
Could you help me please