I'm working on a new script that needs to add a NULL-pointer check if
one does not already exist. For example:
x = (MYTYPE)MACRO(params);
should become
x = (MYTYPE)MACRO(params);
if (!x) {
do_something;
}
My problem is that I want coccinelle to add the if-check only if it
doesn't already exist. So currently I have this:
@@
type T;
expression x;
@@
x = (T)MACRO(...);
+if (x == NULL)
+{
+ status = ERROR;
+ goto exit;
+}
How do I make sure that these lines are not added if they already
exist? I need to check for "if (x == NULL)" and "if (!x)" variants.
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci