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:
Julia Lawall
2026-08-23 22:12:09 +02:00
parent b32cf68d78
commit fd0a63f086
+4 -4
View File
@@ -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)
...>
}