Skip to content
Snippets Groups Projects
Commit ae239fc8 authored by René Scharfe's avatar René Scharfe Committed by Junio C Hamano
Browse files

cocci: simplify check for trivial format strings


353d84c5 (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: default avatarRene Scharfe <l.s.r@web.de>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent 8279ed03
No related branches found
No related tags found
No related merge requests found
@ 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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment