CLEANUP: Apply ist.cocci
This cleans up ist handling.
diff --git a/addons/ot/src/http.c b/addons/ot/src/http.c
index 0d824dd..3376a3b 100644
--- a/addons/ot/src/http.c
+++ b/addons/ot/src/http.c
@@ -220,12 +220,10 @@
}
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 @@
(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. */
diff --git a/addons/promex/service-prometheus.c b/addons/promex/service-prometheus.c
index 6a42a47..2070b9c 100644
--- a/addons/promex/service-prometheus.c
+++ b/addons/promex/service-prometheus.c
@@ -1006,7 +1006,7 @@
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;
diff --git a/include/haproxy/htx.h b/include/haproxy/htx.h
index 93b3206..0faf296 100644
--- a/include/haproxy/htx.h
+++ b/include/haproxy/htx.h
@@ -385,8 +385,8 @@
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 @@
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:
diff --git a/src/hlua.c b/src/hlua.c
index a158c46..4bce23f 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -6315,8 +6315,7 @@
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 @@
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;
}
diff --git a/src/stream.c b/src/stream.c
index 27062ea..89e85d8 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -3010,7 +3010,7 @@
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')",