[master] 4127a37a0 Add VRT_synth_blob(). Rename VRT_synth_page() to VRT_synth_strands()

Poul-Henning Kamp phk at FreeBSD.org
Thu Feb 4 08:34:07 UTC 2021


commit 4127a37a0fc6a77758439dcbd992ca4d18159dfd
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Feb 4 08:32:32 2021 +0000

    Add VRT_synth_blob(). Rename VRT_synth_page() to VRT_synth_strands()
    
    (VRT_synth_page() still works, but is now deprecated.)

diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index 9421f529d..aab4b72e9 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -817,7 +817,7 @@ VRT_Rollback(VRT_CTX, VCL_HTTP hp)
 /*--------------------------------------------------------------------*/
 
 VCL_VOID
-VRT_synth_page(VRT_CTX, VCL_STRANDS s)
+VRT_synth_strands(VRT_CTX, VCL_STRANDS s)
 {
 	struct vsb *vsb;
 	int i;
@@ -832,6 +832,22 @@ VRT_synth_page(VRT_CTX, VCL_STRANDS s)
 	}
 }
 
+VCL_VOID
+VRT_synth_blob(VRT_CTX, VCL_BLOB b)
+{
+	struct vsb *vsb;
+	CAST_OBJ_NOTNULL(vsb, ctx->specific, VSB_MAGIC);
+
+	if (b->len > 0 && b->blob != NULL)
+		VSB_bcat(vsb, b->blob, b->len);
+}
+
+VCL_VOID
+VRT_synth_page(VRT_CTX, VCL_STRANDS s)
+{
+	VRT_synth_strands(ctx, s);
+}
+
 /*--------------------------------------------------------------------*/
 
 static VCL_STRING
diff --git a/include/vrt.h b/include/vrt.h
index 61148778e..b882b1136 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -53,6 +53,8 @@
  * binary/load-time compatible, increment MAJOR version
  *
  * 13.0 (2021-03-15)
+ *	Move VRT_synth_page() to deprecated status
+ *	Add VRT_synth_strands() and VRT_synth_blob()
  *	struct vrt_type now produced by generate.py
  *	VRT_acl_log() moved to VPI_acl_log()
  *	VRT_Endpoint_Clone() added.
@@ -546,7 +548,8 @@ VCL_VOID VRT_hashdata(VRT_CTX, VCL_STRANDS);
 VCL_VOID VRT_Rollback(VRT_CTX, VCL_HTTP);
 
 /* Synthetic pages */
-VCL_VOID VRT_synth_page(VRT_CTX, VCL_STRANDS);
+VCL_VOID VRT_synth_strands(VRT_CTX, VCL_STRANDS);
+VCL_VOID VRT_synth_blob(VRT_CTX, VCL_BLOB);
 
 /***********************************************************************
  * VDI - Director API
@@ -646,9 +649,10 @@ struct vclref * VRT_VCL_Prevent_Discard(VRT_CTX, const char *);
 void VRT_VCL_Allow_Discard(struct vclref **);
 
 /***********************************************************************
- * Deprecated interfaces, do not use
+ * Deprecated interfaces, do not use, they will disappear at some point.
  */
 
+VCL_VOID VRT_synth_page(VRT_CTX, VCL_STRANDS);
 extern const void * const vrt_magic_string_end;
 extern const void * const vrt_magic_string_unset;
 int VRT_Stv(const char *nm);
diff --git a/lib/libvcc/vcc_action.c b/lib/libvcc/vcc_action.c
index eed78708a..10ee8e4c5 100644
--- a/lib/libvcc/vcc_action.c
+++ b/lib/libvcc/vcc_action.c
@@ -387,7 +387,7 @@ vcc_act_synthetic(struct vcc *tl, struct token *t, struct symbol *sym)
 	ERRCHK(tl);
 	vcc_NextToken(tl);
 
-	Fb(tl, 1, "VRT_synth_page(ctx, ");
+	Fb(tl, 1, "VRT_synth_strands(ctx, ");
 	vcc_Expr(tl, STRANDS);
 	ERRCHK(tl);
 	Fb(tl, 1, ");\n");


More information about the varnish-commit mailing list