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

dev/coccinelle/ist.cocci

index 4945141b25b617dffb5ce7b3c6a69d922ac9de0f..680afbadee1a94f74c24c94720e859be0c57624d 100644 (file)
@@ -60,6 +60,14 @@ struct buffer *b;
 - chunk_memcat(b, \(i.ptr\|istptr(i)\) , \(i.len\|istlen(i)\));
 + chunk_istcat(b, i);
 
+@@
+struct ist i;
+struct buffer *b;
+@@
+
+- chunk_strncat(b, \(i.ptr\|istptr(i)\) , \(i.len\|istlen(i)\));
++ chunk_istcat(b, i);
+
 @@
 struct ist i;
 @@