Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/tools/coccinelle/strvec.cocci # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / tools / coccinelle / strvec.cocci` 46 lines ยท 819 bytes Raw Blame History 1 @@ 2 type T; 3 identifier i; 4 expression dst; 5 struct strvec *src_ptr; 6 struct 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 @ 17 type T; 18 identifier i; 19 expression dst; 20 struct strvec *src_ptr; 21 struct 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 - }