summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2019-02-05 14:26:18 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-02-05 14:26:18 -0800
commit5db562704ca1541f1ace2510f830ea1370ce60e4 (patch)
tree869a28a2909e7a1cebda9357731392a11aef587a /contrib
parentMerge branch 'az/instaweb-py3-http-server' (diff)
parentstrbuf.cocci: suggest strbuf_addbuf() to add one strbuf to an other (diff)
downloadtgif-5db562704ca1541f1ace2510f830ea1370ce60e4.tar.xz
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
Diffstat (limited to 'contrib')
-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 e34eada1ad..d9ada69b43 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";
@@