[master] 3982ed51d refactor vcl_load for separate vsb for VSL_Open
Nils Goroll
nils.goroll at uplex.de
Mon Mar 2 15:22:06 UTC 2020
commit 3982ed51d9a38fb6b08677fde7c41fc8ad2276f7
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Thu Feb 13 19:23:14 2020 +0100
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
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index a093e572c..dba873d0b 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -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);
More information about the varnish-commit
mailing list