summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-02-05 22:26:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-02-05 22:26:18 (GMT)
commit5db562704ca1541f1ace2510f830ea1370ce60e4 (patch)
tree869a28a2909e7a1cebda9357731392a11aef587a
parentabf39e3396f597adfac1f37a3b5706950dadfec3 (diff)
parent28c23cd4c3902449aff72cb9a4a703220be0d6ac (diff)
downloadgit-5db562704ca1541f1ace2510f830ea1370ce60e4.zip
git-5db562704ca1541f1ace2510f830ea1370ce60e4.tar.gz
git-5db562704ca1541f1ace2510f830ea1370ce60e4.tar.bz2
Merge branch 'sg/strbuf-addbuf-cocci'
Cocci rule update. * sg/strbuf-addbuf-cocci: strbuf.cocci: suggest strbuf_addbuf() to add one strbuf to an other
-rw-r--r--contrib/coccinelle/strbuf.cocci30
1 files changed, 30 insertions, 0 deletions
diff --git a/contrib/coccinelle/strbuf.cocci b/contrib/coccinelle/strbuf.cocci
index e34eada..d9ada69 100644
--- a/contrib/coccinelle/strbuf.cocci
+++ b/contrib/coccinelle/strbuf.cocci
@@ -13,6 +13,36 @@ constant fmt !~ "%";
);
@@
+expression E;
+struct strbuf SB;
+format F =~ "s";
+@@
+- strbuf_addf(E, "%@F@", SB.buf);
++ strbuf_addbuf(E, &SB);
+
+@@
+expression E;
+struct strbuf *SBP;
+format F =~ "s";
+@@
+- strbuf_addf(E, "%@F@", SBP->buf);
++ strbuf_addbuf(E, SBP);
+
+@@
+expression E;
+struct strbuf SB;
+@@
+- strbuf_addstr(E, SB.buf);
++ strbuf_addbuf(E, &SB);
+
+@@
+expression E;
+struct strbuf *SBP;
+@@
+- strbuf_addstr(E, SBP->buf);
++ strbuf_addbuf(E, SBP);
+
+@@
expression E1, E2;
format F =~ "s";
@@