To get malloc also, make a metavariable of type T and put (T)x(...).
An isomorphism will consider it to be absent if needed.
I admit that I was not familiar enough with this handling of a cast operator in
the context of the semantic patch language.
Now I get the expected result for my source code example.
elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch -sp_file
../assignment_pattern2.cocci Cstdlib-test1.c -I /usr/include
init_defs_builtins: /usr/share/coccinelle/standard.h
HANDLING: Cstdlib-test1.c
diff =
--- Cstdlib-test1.c
+++ /tmp/cocci-output-10545-36334d-Cstdlib-test1.c
@@ -13,13 +13,11 @@ static void action(int ID)
int main(void)
{
static char const name[] = "check.txt";
- char* x = (char*) malloc(123);
strcpy(x, name);
signal(SIGTERM, action);
{
- FILE* c = fopen(x, "r");
{
printf("file: %s\npointer: %p\n", x, c);
I'm sorry that our discussion has become so long to get there.
Thanks for your support.
Would you like to integrate this filter approach into a demonstration directory
of your source code repository?
Can any more software developers and reviewers benefit from such a result that
we have achieved together after a while?
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)