Merge branch 'rs/cocci-strbuf-addf-to-addstr' into next
authorJunio C Hamano <gitster@pobox.com>
Thu, 8 Feb 2018 23:08:28 +0000 (15:08 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Feb 2018 23:08:28 +0000 (15:08 -0800)
* rs/cocci-strbuf-addf-to-addstr:
cocci: simplify check for trivial format strings

1  2 
contrib/coccinelle/strbuf.cocci
index 6fe8727421101efc04c15d8c6def448984eff74d,ce2e92c6e95d90d490e958ddf820f44d1f51061e..e34eada1ad52933230c7fcace595677747f9e1d6
@@@ -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);
  
  @@