summaryrefslogtreecommitdiff
path: root/contrib/coccinelle
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2018-02-01 18:56:34 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-02-02 22:30:12 (GMT)
commitae239fc8e57a5758e9db63c0bceaca933d217f81 (patch)
treefd344617b192762a2ae85ac84e3878f73848b447 /contrib/coccinelle
parent8279ed033f703d4115bee620dccd32a9ec94d9aa (diff)
downloadgit-ae239fc8e57a5758e9db63c0bceaca933d217f81.zip
git-ae239fc8e57a5758e9db63c0bceaca933d217f81.tar.gz
git-ae239fc8e57a5758e9db63c0bceaca933d217f81.tar.bz2
cocci: simplify check for trivial format strings
353d84c537 (coccicheck: make transformation for strbuf_addf(sb, "...") more precise) added a check to avoid transforming calls with format strings which contain percent signs, as that would change the result. It uses embedded Python code for that. Simplify this rule by using the regular expression matching operator instead. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/coccinelle')
-rw-r--r--contrib/coccinelle/strbuf.cocci17
1 files changed, 1 insertions, 16 deletions
diff --git a/contrib/coccinelle/strbuf.cocci b/contrib/coccinelle/strbuf.cocci
index 1d580e4..ce2e92c 100644
--- a/contrib/coccinelle/strbuf.cocci
+++ b/contrib/coccinelle/strbuf.cocci
@@ -1,21 +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