mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-29 14:50:59 +01:00
CLEANUP: Reapply ist.cocci with --include-headers-for-types --recursive-includes
Previous uses of `ist.cocci` did not add `--include-headers-for-types` and
`--recursive-includes` preventing Coccinelle seeing `struct ist` members of
other structs.
Reapply the patch with proper flags to further clean up the use of the ist API.
The command used was:
spatch -sp_file dev/coccinelle/ist.cocci -in_place --include-headers --include-headers-for-types --recursive-includes --dir src/
This commit is contained in:
parent
99f47377c8
commit
7750850594
@ -626,7 +626,7 @@ cache_store_http_payload(struct stream *s, struct filter *filter, struct http_ms
|
|||||||
|
|
||||||
info = (type << 28) + v.len;
|
info = (type << 28) + v.len;
|
||||||
chunk_memcat(&trash, (char *)&info, sizeof(info));
|
chunk_memcat(&trash, (char *)&info, sizeof(info));
|
||||||
chunk_memcat(&trash, v.ptr, v.len);
|
chunk_istcat(&trash, v);
|
||||||
to_forward += v.len;
|
to_forward += v.len;
|
||||||
len -= v.len;
|
len -= v.len;
|
||||||
break;
|
break;
|
||||||
|
|||||||
12
src/fcgi.c
12
src/fcgi.c
@ -197,10 +197,8 @@ size_t fcgi_decode_param(const struct buffer *in, size_t o, struct fcgi_param *p
|
|||||||
if (data < nlen + vlen)
|
if (data < nlen + vlen)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
p->n.ptr = b_peek(in, o);
|
p->n = ist2(b_peek(in, o), nlen);
|
||||||
p->n.len = nlen;
|
p->v = ist2(b_peek(in, o + nlen), vlen);
|
||||||
p->v.ptr = b_peek(in, o+nlen);
|
|
||||||
p->v.len = vlen;
|
|
||||||
len += nlen + vlen;
|
len += nlen + vlen;
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
@ -254,10 +252,8 @@ size_t fcgi_aligned_decode_param(const struct buffer *in, size_t o, struct fcgi_
|
|||||||
if (data < nlen + vlen)
|
if (data < nlen + vlen)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
p->n.ptr = in->area + o;
|
p->n = ist2(in->area + o, nlen);
|
||||||
p->n.len = nlen;
|
p->v = ist2(in->area + o + nlen, vlen);
|
||||||
p->v.ptr = in->area + o + nlen;
|
|
||||||
p->v.len = vlen;
|
|
||||||
len += nlen + vlen;
|
len += nlen + vlen;
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
|
|||||||
@ -400,26 +400,26 @@ select_compression_request_header(struct comp_state *st, struct stream *s, struc
|
|||||||
|
|
||||||
qval = ctx.value.ptr + toklen;
|
qval = ctx.value.ptr + toklen;
|
||||||
while (1) {
|
while (1) {
|
||||||
while (qval < ctx.value.ptr + ctx.value.len && HTTP_IS_LWS(*qval))
|
while (qval < istend(ctx.value) && HTTP_IS_LWS(*qval))
|
||||||
qval++;
|
qval++;
|
||||||
|
|
||||||
if (qval >= ctx.value.ptr + ctx.value.len || *qval != ';') {
|
if (qval >= istend(ctx.value) || *qval != ';') {
|
||||||
qval = NULL;
|
qval = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
qval++;
|
qval++;
|
||||||
|
|
||||||
while (qval < ctx.value.ptr + ctx.value.len && HTTP_IS_LWS(*qval))
|
while (qval < istend(ctx.value) && HTTP_IS_LWS(*qval))
|
||||||
qval++;
|
qval++;
|
||||||
|
|
||||||
if (qval >= ctx.value.ptr + ctx.value.len) {
|
if (qval >= istend(ctx.value)) {
|
||||||
qval = NULL;
|
qval = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (strncmp(qval, "q=", MIN(ctx.value.ptr + ctx.value.len - qval, 2)) == 0)
|
if (strncmp(qval, "q=", MIN(istend(ctx.value) - qval, 2)) == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
while (qval < ctx.value.ptr + ctx.value.len && *qval != ';')
|
while (qval < istend(ctx.value) && *qval != ';')
|
||||||
qval++;
|
qval++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
6
src/h1.c
6
src/h1.c
@ -428,8 +428,7 @@ int h1_headers_to_hdr_list(char *start, const char *stop,
|
|||||||
http_msg_req09_uri_e:
|
http_msg_req09_uri_e:
|
||||||
sl.rq.u.len = ptr - sl.rq.u.ptr;
|
sl.rq.u.len = ptr - sl.rq.u.ptr;
|
||||||
http_msg_req09_ver:
|
http_msg_req09_ver:
|
||||||
sl.rq.v.ptr = ptr;
|
sl.rq.v = ist2(ptr, 0);
|
||||||
sl.rq.v.len = 0;
|
|
||||||
goto http_msg_rqline_eol;
|
goto http_msg_rqline_eol;
|
||||||
}
|
}
|
||||||
state = H1_MSG_RQMETH;
|
state = H1_MSG_RQMETH;
|
||||||
@ -659,8 +658,7 @@ int h1_headers_to_hdr_list(char *start, const char *stop,
|
|||||||
sl.st.c.len = ptr - sl.st.c.ptr;
|
sl.st.c.len = ptr - sl.st.c.ptr;
|
||||||
|
|
||||||
http_msg_rsp_reason:
|
http_msg_rsp_reason:
|
||||||
sl.st.r.ptr = ptr;
|
sl.st.r = ist2(ptr, 0);
|
||||||
sl.st.r.len = 0;
|
|
||||||
goto http_msg_rpline_eol;
|
goto http_msg_rpline_eol;
|
||||||
|
|
||||||
case H1_MSG_RPCODE_SP:
|
case H1_MSG_RPCODE_SP:
|
||||||
|
|||||||
6
src/h2.c
6
src/h2.c
@ -402,7 +402,7 @@ int h2_make_htx_request(struct http_hdr *list, struct htx *htx, unsigned int *ms
|
|||||||
lck = ck = -1; // no cookie for now
|
lck = ck = -1; // no cookie for now
|
||||||
fields = 0;
|
fields = 0;
|
||||||
for (idx = 0; list[idx].n.len != 0; idx++) {
|
for (idx = 0; list[idx].n.len != 0; idx++) {
|
||||||
if (!list[idx].n.ptr) {
|
if (!isttest(list[idx].n)) {
|
||||||
/* this is an indexed pseudo-header */
|
/* this is an indexed pseudo-header */
|
||||||
phdr = list[idx].n.len;
|
phdr = list[idx].n.len;
|
||||||
}
|
}
|
||||||
@ -721,7 +721,7 @@ int h2_make_htx_response(struct http_hdr *list, struct htx *htx, unsigned int *m
|
|||||||
|
|
||||||
fields = 0;
|
fields = 0;
|
||||||
for (idx = 0; list[idx].n.len != 0; idx++) {
|
for (idx = 0; list[idx].n.len != 0; idx++) {
|
||||||
if (!list[idx].n.ptr) {
|
if (!isttest(list[idx].n)) {
|
||||||
/* this is an indexed pseudo-header */
|
/* this is an indexed pseudo-header */
|
||||||
phdr = list[idx].n.len;
|
phdr = list[idx].n.len;
|
||||||
}
|
}
|
||||||
@ -873,7 +873,7 @@ int h2_make_htx_trailers(struct http_hdr *list, struct htx *htx)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (idx = 0; list[idx].n.len != 0; idx++) {
|
for (idx = 0; list[idx].n.len != 0; idx++) {
|
||||||
if (!list[idx].n.ptr) {
|
if (!isttest(list[idx].n)) {
|
||||||
/* This is an indexed pseudo-header (RFC7540#8.1.2.1) */
|
/* This is an indexed pseudo-header (RFC7540#8.1.2.1) */
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1099,7 +1099,7 @@ static int smp_fetch_base(const struct arg *args, struct sample *smp, const char
|
|||||||
|
|
||||||
/* OK we have the header value in ctx.value */
|
/* OK we have the header value in ctx.value */
|
||||||
temp = get_trash_chunk();
|
temp = get_trash_chunk();
|
||||||
chunk_memcat(temp, ctx.value.ptr, ctx.value.len);
|
chunk_istcat(temp, ctx.value);
|
||||||
|
|
||||||
/* now retrieve the path */
|
/* now retrieve the path */
|
||||||
sl = http_get_stline(htx);
|
sl = http_get_stline(htx);
|
||||||
|
|||||||
@ -139,7 +139,7 @@ static int __http_find_header(const struct htx *htx, const void *pattern, struct
|
|||||||
if (flags & HTTP_FIND_FL_FULL)
|
if (flags & HTTP_FIND_FL_FULL)
|
||||||
goto next_blk;
|
goto next_blk;
|
||||||
v = htx_get_blk_value(htx, blk);
|
v = htx_get_blk_value(htx, blk);
|
||||||
p = ctx->value.ptr + ctx->value.len + ctx->lws_after;
|
p = istend(ctx->value) + ctx->lws_after;
|
||||||
v.len -= (p - v.ptr);
|
v.len -= (p - v.ptr);
|
||||||
v.ptr = p;
|
v.ptr = p;
|
||||||
if (!v.len)
|
if (!v.len)
|
||||||
@ -574,8 +574,7 @@ int http_replace_header_value(struct htx *htx, struct http_hdr_ctx *ctx, const s
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx->blk = blk;
|
ctx->blk = blk;
|
||||||
ctx->value.ptr = v.ptr + off;
|
ctx->value = ist2(v.ptr + off, data.len);
|
||||||
ctx->value.len = data.len;
|
|
||||||
ctx->lws_before = ctx->lws_after = 0;
|
ctx->lws_before = ctx->lws_after = 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -674,8 +673,7 @@ int http_remove_header(struct htx *htx, struct http_hdr_ctx *ctx)
|
|||||||
htx_change_blk_value_len(htx, blk, v.len-len);
|
htx_change_blk_value_len(htx, blk, v.len-len);
|
||||||
|
|
||||||
/* Finally update the ctx */
|
/* Finally update the ctx */
|
||||||
ctx->value.ptr = start;
|
ctx->value = ist2(start, 0);
|
||||||
ctx->value.len = 0;
|
|
||||||
ctx->lws_before = ctx->lws_after = 0;
|
ctx->lws_before = ctx->lws_after = 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -1057,7 +1055,7 @@ static int http_htx_init(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
raw = ist2(http_err_msgs[rc], strlen(http_err_msgs[rc]));
|
raw = ist(http_err_msgs[rc]);
|
||||||
if (!http_str_to_htx(&chk, raw, &errmsg)) {
|
if (!http_str_to_htx(&chk, raw, &errmsg)) {
|
||||||
ha_alert("Internal error: invalid default message for HTTP return code %d: %s.\n",
|
ha_alert("Internal error: invalid default message for HTTP return code %d: %s.\n",
|
||||||
http_err_codes[rc], errmsg);
|
http_err_codes[rc], errmsg);
|
||||||
|
|||||||
@ -1803,7 +1803,7 @@ void __send_log(struct list *logsrvs, struct buffer *tagb, int level,
|
|||||||
|
|
||||||
if (!metadata[LOG_META_HOST].len) {
|
if (!metadata[LOG_META_HOST].len) {
|
||||||
if (global.log_send_hostname)
|
if (global.log_send_hostname)
|
||||||
metadata[LOG_META_HOST] = ist2(global.log_send_hostname, strlen(global.log_send_hostname));
|
metadata[LOG_META_HOST] = ist(global.log_send_hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tagb || !tagb->area)
|
if (!tagb || !tagb->area)
|
||||||
|
|||||||
@ -1417,7 +1417,7 @@ static int fcgi_set_default_param(struct fcgi_conn *fconn, struct fcgi_strm *fst
|
|||||||
|
|
||||||
params->scriptname = ist2(b_tail(params->p), len+fconn->app->index.len);
|
params->scriptname = ist2(b_tail(params->p), len+fconn->app->index.len);
|
||||||
chunk_istcat(params->p, sn);
|
chunk_istcat(params->p, sn);
|
||||||
chunk_memcat(params->p, fconn->app->index.ptr, fconn->app->index.len);
|
chunk_istcat(params->p, fconn->app->index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1494,16 +1494,16 @@ static int fcgi_encode_default_param(struct fcgi_conn *fconn, struct fcgi_strm *
|
|||||||
goto encode;
|
goto encode;
|
||||||
case FCGI_SP_SCRIPT_FILE:
|
case FCGI_SP_SCRIPT_FILE:
|
||||||
p.n = ist("SCRIPT_FILENAME");
|
p.n = ist("SCRIPT_FILENAME");
|
||||||
chunk_memcat(&trash, params->docroot.ptr, params->docroot.len);
|
chunk_istcat(&trash, params->docroot);
|
||||||
chunk_memcat(&trash, params->scriptname.ptr, params->scriptname.len);
|
chunk_istcat(&trash, params->scriptname);
|
||||||
p.v = ist2(b_head(&trash), b_data(&trash));
|
p.v = ist2(b_head(&trash), b_data(&trash));
|
||||||
goto encode;
|
goto encode;
|
||||||
case FCGI_SP_PATH_TRANS:
|
case FCGI_SP_PATH_TRANS:
|
||||||
if (!istlen(params->pathinfo))
|
if (!istlen(params->pathinfo))
|
||||||
goto skip;
|
goto skip;
|
||||||
p.n = ist("PATH_TRANSLATED");
|
p.n = ist("PATH_TRANSLATED");
|
||||||
chunk_memcat(&trash, params->docroot.ptr, params->docroot.len);
|
chunk_istcat(&trash, params->docroot);
|
||||||
chunk_memcat(&trash, params->pathinfo.ptr, params->pathinfo.len);
|
chunk_istcat(&trash, params->pathinfo);
|
||||||
p.v = ist2(b_head(&trash), b_data(&trash));
|
p.v = ist2(b_head(&trash), b_data(&trash));
|
||||||
goto encode;
|
goto encode;
|
||||||
case FCGI_SP_CONT_LEN:
|
case FCGI_SP_CONT_LEN:
|
||||||
|
|||||||
@ -2595,7 +2595,7 @@ static int h1_send_error(struct h1c *h1c)
|
|||||||
TRACE_STATE("waiting for h1c obuf allocation", H1_EV_H1C_ERR|H1_EV_H1C_BLK, h1c->conn);
|
TRACE_STATE("waiting for h1c obuf allocation", H1_EV_H1C_ERR|H1_EV_H1C_BLK, h1c->conn);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
ret = b_istput(&h1c->obuf, ist2(http_err_msgs[rc], strlen(http_err_msgs[rc])));
|
ret = b_istput(&h1c->obuf, ist(http_err_msgs[rc]));
|
||||||
if (unlikely(ret <= 0)) {
|
if (unlikely(ret <= 0)) {
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
h1c->flags |= (H1C_F_OUT_FULL|H1C_F_ERR_PENDING);
|
h1c->flags |= (H1C_F_OUT_FULL|H1C_F_ERR_PENDING);
|
||||||
|
|||||||
@ -205,7 +205,7 @@ int sink_announce_dropped(struct sink *sink, int facility)
|
|||||||
|
|
||||||
if (!metadata[LOG_META_HOST].len) {
|
if (!metadata[LOG_META_HOST].len) {
|
||||||
if (global.log_send_hostname)
|
if (global.log_send_hostname)
|
||||||
metadata[LOG_META_HOST] = ist2(global.log_send_hostname, strlen(global.log_send_hostname));
|
metadata[LOG_META_HOST] = ist(global.log_send_hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!metadata[LOG_META_TAG].len)
|
if (!metadata[LOG_META_TAG].len)
|
||||||
|
|||||||
@ -4992,7 +4992,7 @@ static struct tcpcheck_rule *proxy_parse_httpchk_req(char **args, int cur_arg, s
|
|||||||
}
|
}
|
||||||
LIST_INIT(&hdr->value);
|
LIST_INIT(&hdr->value);
|
||||||
hdr->name = istdup(tmp_hdrs[i].n);
|
hdr->name = istdup(tmp_hdrs[i].n);
|
||||||
if (!hdr->name.ptr) {
|
if (!isttest(hdr->name)) {
|
||||||
memprintf(errmsg, "out of memory");
|
memprintf(errmsg, "out of memory");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user