completion: add --skip for cherry-pick and revert
[git/git.git] / contrib / coccinelle / array.cocci
1 @@
2 expression dst, src, n, E;
3 @@
4 memcpy(dst, src, n * sizeof(
5 - E[...]
6 + *(E)
7 ))
8
9 @@
10 type T;
11 T *ptr;
12 T[] arr;
13 expression E, n;
14 @@
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 )
36
37 @@
38 type T;
39 T *dst_ptr;
40 T *src_ptr;
41 T[] dst_arr;
42 T[] src_arr;
43 expression n;
44 @@
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 )
58
59 @@
60 type T;
61 T *dst;
62 T *src;
63 expression 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
76 @@
77 type T;
78 T *ptr;
79 expression n;
80 @@
81 - ptr = xmalloc((n) * sizeof(*ptr));
82 + ALLOC_ARRAY(ptr, n);
83
84 @@
85 type T;
86 T *ptr;
87 expression n;
88 @@
89 - ptr = xmalloc((n) * sizeof(T));
90 + ALLOC_ARRAY(ptr, n);