DEV: coccinelle: Add rule to use isttrim() where possible

This replaces `if (i.len > e) i.len = e;` by `isttrim(i, e)`.
This commit is contained in:
Tim Duesterhus 2021-11-08 09:05:00 +01:00 committed by Willy Tarreau
parent e9f4d67b15
commit 9b80a6ca8f

View File

@ -44,6 +44,14 @@ struct ist i;
- (\(i.ptr\|istptr(i)\) + \(i.len\|istlen(i)\))
+ istend(i)
@@
struct ist i;
expression e;
@@
- if (\(i.len\|istlen(i)\) > e) { i.len = e; }
+ i = isttrim(i, e);
@@
struct ist i;
@@