interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / tools / coccinelle / strvec.cocci

46 lines · 819 bytes Raw Blame History
1@@
2type T;
3identifier i;
4expression dst;
5struct strvec *src_ptr;
6struct strvec src_arr;
7@@
8(
9- for (T i = 0; i < src_ptr->nr; i++) { strvec_push(dst, src_ptr->v[i]); }
10+ strvec_pushv(dst, src_ptr->v);
11|
12- for (T i = 0; i < src_arr.nr; i++) { strvec_push(dst, src_arr.v[i]); }
13+ strvec_pushv(dst, src_arr.v);
14)
15
16@ separate_loop_index @
17type T;
18identifier i;
19expression dst;
20struct strvec *src_ptr;
21struct strvec src_arr;
22@@
23 T i;
24 ...
25(
26- for (i = 0; i < src_ptr->nr; i++) { strvec_push(dst, src_ptr->v[i]); }
27+ strvec_pushv(dst, src_ptr->v);
28|
29- for (i = 0; i < src_arr.nr; i++) { strvec_push(dst, src_arr.v[i]); }
30+ strvec_pushv(dst, src_arr.v);
31)
32
33@ unused_loop_index extends separate_loop_index @
34@@
35 {
36 ...
37- T i;
38 ... when != i
39 }
40
41@ depends on unused_loop_index @
42@@
43 if (...)
44- {
45 strvec_pushv(...);
46- }