浏览代码

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

Mansour Moufid 10 年之前
父节点
当前提交
3ab2c865bf
共有 1 个文件被更改,包括 7 次插入0 次删除
  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;