refactor vcl_load for separate vsb for VSL_Open

In preparation for the next commit, we avoid using the ctx->msg vsl and
use a separate vsl for the VCL_Open step of vcl_load.

Ref #2902
parent a6051ba7
......@@ -611,6 +611,7 @@ vcl_load(struct cli *cli, struct vrt_ctx *ctx,
const char *name, const char *fn, const char *state)
{
struct vcl *vcl;
struct vsb *msg;
int i;
ASSERT_CLI();
......@@ -618,14 +619,18 @@ vcl_load(struct cli *cli, struct vrt_ctx *ctx,
vcl = vcl_find(name);
AZ(vcl);
vcl = VCL_Open(fn, ctx->msg);
msg = VSB_new_auto();
vcl = VCL_Open(fn, msg);
AZ(VSB_finish(ctx->msg));
if (vcl == NULL) {
AZ(VSB_finish(ctx->msg));
VCLI_SetResult(cli, CLIS_PARAM);
VCLI_Out(cli, "%s", VSB_data(ctx->msg));
VSB_destroy(&msg);
return;
}
VSB_destroy(&msg);
vcl->loaded_name = strdup(name);
XXXAN(vcl->loaded_name);
VTAILQ_INIT(&vcl->director_list);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment