summaryrefslogtreecommitdiffstats
path: root/contrib/coccinelle/qsort.cocci
blob: 22b93a99664d2745aa74c6566be0225f6842e882 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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);