Merge branch 'rs/strbuf-cocci-workaround'
authorJunio C Hamano <gitster@pobox.com>
Tue, 13 Feb 2018 21:39:12 +0000 (13:39 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Feb 2018 21:39:12 +0000 (13:39 -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);
 
 @@