From a6a327918842577a5e49d89afb79a2d4509fa38d Mon Sep 17 00:00:00 2001 From: Tim Duesterhus Date: Sat, 5 Mar 2022 00:52:45 +0100 Subject: [PATCH] CLEANUP: fcgi: Use `istadv()` in `fcgi_strm_send_params` 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 0a8679019a..ef264edaef 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.47.3