From d3ebb9f4ad7612d95da052cb214dc3e2624c093b Mon Sep 17 00:00:00 2001 From: Nils Goroll Date: Wed, 19 Aug 2020 16:19:52 +0200 Subject: [PATCH] Use WS_VSB for saintmode.status --- src/vmod_saintmode.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/vmod_saintmode.c b/src/vmod_saintmode.c index 7009bfba..b5a4bd0a 100644 --- a/src/vmod_saintmode.c +++ b/src/vmod_saintmode.c @@ -153,14 +153,12 @@ vmod_status(VRT_CTX, struct vmod_priv *priv) { struct saintmode_objs *sm_objs; struct vmod_saintmode_saintmode *sm; - struct vsb *vsb; - void *p; + struct vsb vsb[1]; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CAST_OBJ_NOTNULL(sm_objs, priv->priv, SAINTMODE_OBJS_MAGIC); - vsb = VSB_new_auto(); - AN(vsb); + WS_VSB_new(vsb, ctx->ws); VSB_cat(vsb, "{\n\t\"saintmode\": [\n"); VTAILQ_FOREACH(sm, &sm_objs->sm_list, list) { @@ -179,15 +177,7 @@ vmod_status(VRT_CTX, struct vmod_priv *priv) VSB_cat(vsb, "\n"); } - VSB_cat(vsb, "\t]\n}\n"); - VSB_finish(vsb); - - p = WS_Copy(ctx->ws, VSB_data(vsb), -1); - if (p == NULL) - VSLb(ctx->vsl, SLT_VCL_Log, - "saintmode.vmod_status: workspace overflow"); - VSB_destroy(&vsb); - return (p); + return (WS_VSB_finish(vsb, ctx->ws, NULL)); } VCL_INT