about summary refs log tree commit diff
path: root/third_party/git/contrib/coccinelle/qsort.cocci
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/git/contrib/coccinelle/qsort.cocci')
-rw-r--r--third_party/git/contrib/coccinelle/qsort.cocci37
1 files changed, 37 insertions, 0 deletions
diff --git a/third_party/git/contrib/coccinelle/qsort.cocci b/third_party/git/contrib/coccinelle/qsort.cocci
new file mode 100644
index 000000000000..22b93a99664d
--- /dev/null
+++ b/third_party/git/contrib/coccinelle/qsort.cocci
@@ -0,0 +1,37 @@
+@@
+expression base, nmemb, compar;
+@@
+- qsort(base, nmemb, sizeof(*base), compar);
++ QSORT(base, nmemb, compar);
+
+@@
+expression base, nmemb, compar;
+@@
+- qsort(base, nmemb, sizeof(base[0]), compar);
++ QSORT(base, nmemb, compar);
+
+@@
+type T;
+T *base;
+expression nmemb, compar;
+@@
+- qsort(base, nmemb, sizeof(T), compar);
++ QSORT(base, nmemb, compar);
+
+@@
+expression base, nmemb, compar;
+@@
+- if (nmemb)
+    QSORT(base, nmemb, compar);
+
+@@
+expression base, nmemb, compar;
+@@
+- if (nmemb > 0)
+    QSORT(base, nmemb, compar);
+
+@@
+expression base, nmemb, compar;
+@@
+- if (nmemb > 1)
+    QSORT(base, nmemb, compar);