Commit 5b7ca450 authored by Hongbo Li's avatar Hongbo Li Committed by Julia Lawall

coccinelle: Add rules to find str_lo{w}_hi{gh}() replacements

As other rules done, we add rules for str_lo{w}_hi{gh}()
to check the relative opportunities.
Signed-off-by: default avatarHongbo Li <lihongbo22@huawei.com>
Signed-off-by: default avatarJulia Lawall <Julia.Lawall@inria.fr>
parent d4c75440
...@@ -165,3 +165,41 @@ e << str_high_low_r.E; ...@@ -165,3 +165,41 @@ e << str_high_low_r.E;
@@ @@
coccilib.report.print_report(p[0], "opportunity for str_high_low(%s)" % e) coccilib.report.print_report(p[0], "opportunity for str_high_low(%s)" % e)
@str_lo_hi depends on patch@
expression E;
@@
- ((E) ? "lo" : "hi")
+ str_lo_hi(E)
@str_lo_hi_r depends on !patch exists@
expression E;
position P;
@@
* ((E@P) ? "lo" : "hi")
@script:python depends on report@
p << str_lo_hi_r.P;
e << str_lo_hi_r.E;
@@
coccilib.report.print_report(p[0], "opportunity for str_lo_hi(%s)" % e)
@str_low_high depends on patch@
expression E;
@@
- ((E) ? "low" : "high")
+ str_low_high(E)
@str_low_high_r depends on !patch exists@
expression E;
position P;
@@
* ((E@P) ? "low" : "high")
@script:python depends on report@
p << str_low_high_r.P;
e << str_low_high_r.E;
@@
coccilib.report.print_report(p[0], "opportunity for str_low_high(%s)" % e)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment