Browse Source

Add a rule to the calloc semantic patch for argument ordering.

Mansour Moufid 9 years ago
parent
commit
3ab2c865bf
1 changed files with 7 additions and 0 deletions
  1. 7 0
      scripts/coccinelle/calloc.cocci

+ 7 - 0
scripts/coccinelle/calloc.cocci

@@ -8,6 +8,13 @@ constant b;
 - f(a * b)
 + tor_calloc(a, b)
 
+@calloc_arg_order@
+expression a;
+type t;
+@@
+- tor_calloc(sizeof(t), a)
++ tor_calloc(a, sizeof(t))
+
 @realloc_to_reallocarray@
 expression a, b;
 expression p;