CLEANUP: Apply ist.cocci

This cleans up ist handling.
This commit is contained in:
Tim Duesterhus 2021-09-15 13:58:44 +02:00 committed by Willy Tarreau
parent 81a76f4827
commit b113b5ca24
5 changed files with 13 additions and 17 deletions

View File

@ -220,12 +220,10 @@ int flt_ot_http_header_set(struct channel *chn, const char *prefix, const char *
}
if (!FLT_OT_STR_ISVALID(prefix)) {
ist_name.ptr = (char *)name;
ist_name.len = strlen(name);
ist_name = ist2((char *)name, strlen(name));
}
else if (!FLT_OT_STR_ISVALID(name)) {
ist_name.ptr = (char *)prefix;
ist_name.len = strlen(prefix);
ist_name = ist2((char *)prefix, strlen(prefix));
}
else {
buffer = flt_ot_trash_alloc(0, err);
@ -234,8 +232,7 @@ int flt_ot_http_header_set(struct channel *chn, const char *prefix, const char *
(void)chunk_printf(buffer, "%s-%s", prefix, name);
ist_name.ptr = buffer->area;
ist_name.len = buffer->data;
ist_name = ist2(buffer->area, buffer->data);
}
/* Remove all occurrences of the header. */

View File

@ -1006,7 +1006,7 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
val = mkf_u32(FO_STATUS, sv->check.status == appctx->ctx.stats.st_code);
check_state = get_check_status_info(appctx->ctx.stats.st_code);
labels[2].name = ist("state");
labels[2].value = ist2(check_state, strlen(check_state));
labels[2].value = ist(check_state);
if (!promex_dump_metric(appctx, htx, prefix, &promex_st_metrics[appctx->st2],
&val, labels, &out, max))
goto full;

View File

@ -385,8 +385,8 @@ static inline struct ist htx_get_blk_name(const struct htx *htx, const struct ht
switch (type) {
case HTX_BLK_HDR:
case HTX_BLK_TLR:
ret.ptr = htx_get_blk_ptr(htx, blk);
ret.len = blk->info & 0xff;
ret = ist2(htx_get_blk_ptr(htx, blk),
blk->info & 0xff);
break;
default:
@ -407,15 +407,15 @@ static inline struct ist htx_get_blk_value(const struct htx *htx, const struct h
switch (type) {
case HTX_BLK_HDR:
case HTX_BLK_TLR:
ret.ptr = htx_get_blk_ptr(htx, blk) + (blk->info & 0xff);
ret.len = (blk->info >> 8) & 0xfffff;
ret = ist2(htx_get_blk_ptr(htx, blk) + (blk->info & 0xff),
(blk->info >> 8) & 0xfffff);
break;
case HTX_BLK_REQ_SL:
case HTX_BLK_RES_SL:
case HTX_BLK_DATA:
ret.ptr = htx_get_blk_ptr(htx, blk);
ret.len = blk->info & 0xfffffff;
ret = ist2(htx_get_blk_ptr(htx, blk),
blk->info & 0xfffffff);
break;
default:

View File

@ -6315,8 +6315,7 @@ static int _hlua_http_msg_dup(struct http_msg *msg, lua_State *L, size_t offset,
case HTX_BLK_DATA:
v = htx_get_blk_value(htx, blk);
v.ptr += offset;
v.len -= offset;
v = istadv(v, offset);
if (v.len > len)
v.len = len;
@ -6417,7 +6416,7 @@ static void _hlua_http_msg_delete(struct http_msg *msg, struct filter *filter, s
v.ptr += htxret.ret;
if (v.len > len)
v.len = len;
blk = htx_replace_blk_value(htx, blk, v, ist2(NULL, 0));
blk = htx_replace_blk_value(htx, blk, v, IST_NULL);
len -= v.len;
ret += v.len;
}

View File

@ -3010,7 +3010,7 @@ static enum act_parse_ret stream_parse_switch_mode(const char **args, int *cur_a
return ACT_RET_PRS_ERR;
}
proto = ist2(args[*cur_arg+2], strlen(args[*cur_arg+2]));
proto = ist(args[*cur_arg + 2]);
mux_proto = get_mux_proto(proto);
if (!mux_proto) {
memprintf(err, "'%s %s': '%s' expects a valid MUX protocol, if specified (got '%s')",