Found manually, while creating the previous commits to turn `struct proxy`
members into ists.

There is an existing Coccinelle rule to replace this pattern by `istadv()` in
`ist.cocci`:

    @@
    struct ist i;
    expression e;
    @@

    - i.ptr += e;
    - i.len -= e;
    + i = istadv(i, e);

But apparently it is not smart enough to match ists that are stored in another
struct. It would be useful to make the existing rule more generic, so that it
might catch similar cases in the future.
---
 src/mux_fcgi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c
index 0a8679019..ef264edae 100644
--- a/src/mux_fcgi.c
+++ b/src/mux_fcgi.c
@@ -1980,8 +1980,7 @@ static size_t fcgi_strm_send_params(struct fcgi_conn 
*fconn, struct fcgi_strm *f
                                p.v = htx_get_blk_value(htx, blk);
 
                                if (istmatch(p.n, ist(":fcgi-"))) {
-                                       p.n.ptr += 6;
-                                       p.n.len -= 6;
+                                       p.n = istadv(p.n, 6);
                                        if (isteq(p.n, 
ist("gateway_interface")))
                                                params.mask |= 
FCGI_SP_CGI_GATEWAY;
                                        else if (isteq(p.n, 
ist("document_root"))) {
-- 
2.35.1


Reply via email to