]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DEV: coccinelle: Add rule to use `istnext()` where possible
authorTim Duesterhus <tim@bastelstu.be>
Thu, 4 Nov 2021 21:35:43 +0000 (22:35 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 5 Nov 2021 06:48:38 +0000 (07:48 +0100)
This matches both `istadv(..., 1)` as well as raw `.ptr++` uses.

dev/coccinelle/ist.cocci

index c3243302f8d789565e8b55985d2221c45d353072..97ce0a2adecba31f795f8d392e97a663eb494820 100644 (file)
@@ -26,6 +26,22 @@ expression e;
 struct ist i;
 @@
 
+- i = istadv(i, 1);
++ i = istnext(i);
+
+@@
+struct ist i;
+expression e;
+@@
+
+- i.ptr++;
+- i.len--;
++ i = istnext(i);
+
+@@
+struct ist i;
+@@
+
 - i.ptr != NULL
 + isttest(i)