From: Junio C Hamano Date: Thu, 8 Feb 2018 23:08:28 +0000 (-0800) Subject: Merge branch 'rs/cocci-strbuf-addf-to-addstr' into next X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/0016008a97d8bc818752d27034948a5ccbc6705b?hp=-c Merge branch 'rs/cocci-strbuf-addf-to-addstr' into next * rs/cocci-strbuf-addf-to-addstr: cocci: simplify check for trivial format strings --- 0016008a97d8bc818752d27034948a5ccbc6705b 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); @@