Hello,

I've just wrote a really simple SMPL (attached to the mail). It makes a
modification on the code which is the following:

- if (x == NULL) S1
+ if (unlikely(x == NULL)) S1

The result is semantically correct but there is spaces at end of line as
shown in the example below:

@@ -173,8 +173,8 @@ DefragContextNew(void)
     DefragContext *dc;
 
     dc = SCCalloc(1, sizeof(*dc));
-    if (dc == NULL)
-        return NULL;<- no space
+    if (unlikely(dc == NULL))
+        return NULL;   <- 4 space here 

I've tried to look at coccinelle code but I'm unable to find a way to a
solution.

Am I missing an option ?

BR,
--
Eric Leblond

@istested@
identifier x;
statement S1;
identifier func =~ "(SCMalloc|SCStrdup|SCCalloc)";
@@

x = func(...)
... when != x
- if (x == NULL) S1
+ if (unlikely(x == NULL)) S1

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to