]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DEV: coccinelle: Add rule to use `chunk_istcat()` instead of `chunk_memcat()`
authorTim Duesterhus <tim@bastelstu.be>
Mon, 8 Nov 2021 08:05:02 +0000 (09:05 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 8 Nov 2021 11:08:26 +0000 (12:08 +0100)
This replaces `chunk_memcat()` with `chunk_istcat()` if the parameters are the
ist's `.ptr` and `.len`.

dev/coccinelle/ist.cocci

index 7e9a6ac0568136bea573428b5a24f08a413c0cf4..4945141b25b617dffb5ce7b3c6a69d922ac9de0f 100644 (file)
@@ -52,6 +52,14 @@ expression e;
 - if (\(i.len\|istlen(i)\) > e) { i.len = e; }
 + i = isttrim(i, e);
 
+@@
+struct ist i;
+struct buffer *b;
+@@
+
+- chunk_memcat(b, \(i.ptr\|istptr(i)\) , \(i.len\|istlen(i)\));
++ chunk_istcat(b, i);
+
 @@
 struct ist i;
 @@