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/strbuf.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 / strbuf.cocci` 86 lines ยท 1167 bytes Raw Blame History 1 @@ 2 expression E; 3 constant fmt !~ "%"; 4 @@ 5 - strbuf_addf 6 + strbuf_addstr 7 (E, 8 ( 9 fmt 10 | 11 _(fmt) 12 ) 13 ); 14 15 @@ 16 expression E; 17 struct strbuf SB; 18 format F =~ "^s$"; 19 @@ 20 - strbuf_addf(E, "%@F@", SB.buf); 21 + strbuf_addbuf(E, &SB); 22 23 @@ 24 expression E; 25 struct strbuf *SBP; 26 format F =~ "^s$"; 27 @@ 28 - strbuf_addf(E, "%@F@", SBP->buf); 29 + strbuf_addbuf(E, SBP); 30 31 @@ 32 expression E; 33 struct strbuf SB; 34 @@ 35 - strbuf_addstr(E, SB.buf); 36 + strbuf_addbuf(E, &SB); 37 38 @@ 39 expression E; 40 struct strbuf *SBP; 41 @@ 42 - strbuf_addstr(E, SBP->buf); 43 + strbuf_addbuf(E, SBP); 44 45 @@ 46 expression E1, E2; 47 format F =~ "^s$"; 48 @@ 49 - strbuf_addf(E1, "%@F@", E2); 50 + strbuf_addstr(E1, E2); 51 52 @@ 53 expression E1, E2, E3; 54 @@ 55 - strbuf_addstr(E1, find_unique_abbrev(E2, E3)); 56 + strbuf_add_unique_abbrev(E1, E2, E3); 57 58 @@ 59 expression E1, E2; 60 @@ 61 - strbuf_addstr(E1, real_path(E2)); 62 + strbuf_add_real_path(E1, E2); 63 64 @@ 65 identifier fn, param; 66 @@ 67 fn(..., 68 - struct strbuf param 69 + struct strbuf *param 70 ,...) 71 { 72 ... 73 } 74 75 // In modern codebase, .buf member of an empty strbuf is not NULL. 76 @@ 77 struct strbuf SB; 78 @@ 79 - SB.buf ? SB.buf : "" 80 + SB.buf 81 82 @@ 83 expression SB, OID; 84 @@ 85 - strbuf_addstr(SB, oid_to_hex(OID)) 86 + strbuf_add_oid_hex(SB, OID)