Merge branch 'rs/strbuf-cocci-workaround' into next
authorJunio C Hamano <gitster@pobox.com>
Wed, 7 Feb 2018 22:55:56 +0000 (14:55 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 7 Feb 2018 22:55:57 +0000 (14:55 -0800)
Update Coccinelle rules to catch and optimize strbuf_addf(&buf, "%s", str)

* rs/strbuf-cocci-workaround:
cocci: use format keyword instead of a literal string

contrib/coccinelle/strbuf.cocci
index 1d580e49b0ca3304ad7b3be62664df47ea84757d..6fe8727421101efc04c15d8c6def448984eff74d 100644 (file)
@@ -29,8 +29,9 @@ cocci.include_match("%" not in fmt)
 
 @@
 expression E1, E2;
+format F =~ "s";
 @@
-- strbuf_addf(E1, "%s", E2);
+- strbuf_addf(E1, "%@F@", E2);
 + strbuf_addstr(E1, E2);
 
 @@