From: Junio C Hamano Date: Thu, 15 Feb 2018 22:55:44 +0000 (-0800) Subject: Merge branch 'rs/cocci-strbuf-addf-to-addstr' X-Git-Tag: v2.17.0-rc0~92 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/ab66fc2705b35833582d74a8cd90ac0cf7586f89?ds=inline;hp=-c Merge branch 'rs/cocci-strbuf-addf-to-addstr' * rs/cocci-strbuf-addf-to-addstr: cocci: simplify check for trivial format strings --- ab66fc2705b35833582d74a8cd90ac0cf7586f89 diff --combined contrib/coccinelle/strbuf.cocci index 6fe8727421,ce2e92c6e9..e34eada1ad --- a/contrib/coccinelle/strbuf.cocci +++ b/contrib/coccinelle/strbuf.cocci @@@ -1,21 -1,6 +1,6 @@@ @ strbuf_addf_with_format_only @ expression E; - constant fmt; - @@ - strbuf_addf(E, - ( - fmt - | - _(fmt) - ) - ); - - @ script:python @ - fmt << strbuf_addf_with_format_only.fmt; - @@ - cocci.include_match("%" not in fmt) - - @ extends strbuf_addf_with_format_only @ + constant fmt !~ "%"; @@ - strbuf_addf + strbuf_addstr @@@ -29,9 -14,8 +14,9 @@@ @@ expression E1, E2; +format F =~ "s"; @@ -- strbuf_addf(E1, "%s", E2); +- strbuf_addf(E1, "%@F@", E2); + strbuf_addstr(E1, E2); @@