]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DEV: coccinelle: Add rule to use `istend()` where possible
authorTim Duesterhus <tim@bastelstu.be>
Sat, 6 Nov 2021 14:14:43 +0000 (15:14 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 8 Nov 2021 06:58:18 +0000 (07:58 +0100)
This replaces `i.ptr + i.len` by `istend()`.

dev/coccinelle/ist.cocci

index 598ffa3e28609fd8c94cea7922652f4648799b97..5b6aa6b2cf8e98e7a7552ea2c53befc2de266995 100644 (file)
@@ -41,6 +41,13 @@ struct ist i;
 struct ist i;
 @@
 
+- (\(i.ptr\|istptr(i)\) + \(i.len\|istlen(i)\))
++ istend(i)
+
+@@
+struct ist i;
+@@
+
 - i.ptr != NULL
 + isttest(i)