completion: add --skip for cherry-pick and revert
[git/git.git] / contrib / coccinelle / array.cocci
CommitLineData
45ccef87 1@@
177fbab7 2expression dst, src, n, E;
45ccef87 3@@
177fbab7
RS
4 memcpy(dst, src, n * sizeof(
5- E[...]
6+ *(E)
7 ))
45ccef87
RS
8
9@@
10type T;
177fbab7
RS
11T *ptr;
12T[] arr;
13expression E, n;
45ccef87 14@@
177fbab7
RS
15(
16 memcpy(ptr, E,
17- n * sizeof(*(ptr))
18+ n * sizeof(T)
19 )
20|
21 memcpy(arr, E,
22- n * sizeof(*(arr))
23+ n * sizeof(T)
24 )
25|
26 memcpy(E, ptr,
27- n * sizeof(*(ptr))
28+ n * sizeof(T)
29 )
30|
31 memcpy(E, arr,
32- n * sizeof(*(arr))
33+ n * sizeof(T)
34 )
35)
45ccef87
RS
36
37@@
38type T;
177fbab7
RS
39T *dst_ptr;
40T *src_ptr;
41T[] dst_arr;
42T[] src_arr;
45ccef87
RS
43expression n;
44@@
177fbab7
RS
45(
46- memcpy(dst_ptr, src_ptr, (n) * sizeof(T))
47+ COPY_ARRAY(dst_ptr, src_ptr, n)
48|
49- memcpy(dst_ptr, src_arr, (n) * sizeof(T))
50+ COPY_ARRAY(dst_ptr, src_arr, n)
51|
52- memcpy(dst_arr, src_ptr, (n) * sizeof(T))
53+ COPY_ARRAY(dst_arr, src_ptr, n)
54|
55- memcpy(dst_arr, src_arr, (n) * sizeof(T))
56+ COPY_ARRAY(dst_arr, src_arr, n)
57)
3f64699f 58
57839807
RS
59@@
60type T;
61T *dst;
62T *src;
63expression n;
64@@
65(
66- memmove(dst, src, (n) * sizeof(*dst));
67+ MOVE_ARRAY(dst, src, n);
68|
69- memmove(dst, src, (n) * sizeof(*src));
70+ MOVE_ARRAY(dst, src, n);
71|
72- memmove(dst, src, (n) * sizeof(T));
73+ MOVE_ARRAY(dst, src, n);
74)
75
3f64699f
RS
76@@
77type T;
78T *ptr;
79expression n;
80@@
9ca356fa 81- ptr = xmalloc((n) * sizeof(*ptr));
3f64699f
RS
82+ ALLOC_ARRAY(ptr, n);
83
84@@
85type T;
86T *ptr;
87expression n;
88@@
9ca356fa 89- ptr = xmalloc((n) * sizeof(T));
3f64699f 90+ ALLOC_ARRAY(ptr, n);