mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 23:09:29 +02:00
coccinelle: misc: minmax: drop unneeded parentheses
The outer parentheses don't matter when just matching an returning a line. Eliminating them reduces the complexity of the pattern to match and gives a small performance improvement in the non-patch cases. Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
This commit is contained in:
@@ -22,14 +22,14 @@ expression E1, E2, E3, E4;
|
||||
binary operator cmp = {>, >=};
|
||||
@@
|
||||
|
||||
(E1 cmp E2 ? E3 : E4)
|
||||
E1 cmp E2 ? E3 : E4
|
||||
|
||||
@min_candidate@
|
||||
expression E1, E2, E3, E4;
|
||||
binary operator cmp = {<, <=};
|
||||
@@
|
||||
|
||||
(E1 cmp E2 ? E3 : E4)
|
||||
E1 cmp E2 ? E3 : E4
|
||||
|
||||
@rmax depends on !patch && max_candidate@
|
||||
identifier func;
|
||||
@@ -41,7 +41,7 @@ position p;
|
||||
func(...)
|
||||
{
|
||||
<...
|
||||
* ((x) cmp@p (y) ? (x) : (y))
|
||||
* (x) cmp@p (y) ? (x) : (y)
|
||||
...>
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ position p != errcode.p;
|
||||
func(...)
|
||||
{
|
||||
<...
|
||||
* ((x) cmp@p (y) ? (x) : (y))
|
||||
* (x) cmp@p (y) ? (x) : (y)
|
||||
...>
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user