[master] d14018ca6 Add a NULL VCL_STRANDS

Nils Goroll nils.goroll at uplex.de
Mon Mar 22 15:13:05 UTC 2021


commit d14018ca607c1ff7b1355360094aaea7130d696c
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Mar 10 17:16:12 2021 +0100

    Add a NULL VCL_STRANDS
    
    ... and document it
    
    The size of 1 for the p array would not be required, it is a safety
    measure only.

diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index a81b6ba41..5cdaf2b3f 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -56,6 +56,10 @@
 
 const void * const vrt_magic_string_end = &vrt_magic_string_end;
 const void * const vrt_magic_string_unset = &vrt_magic_string_unset;
+const struct strands *vrt_null_strands = &(struct strands){
+	.n = 0,
+	.p = (const char *[1]){NULL}
+};
 
 /*--------------------------------------------------------------------*/
 
diff --git a/include/vrt.h b/include/vrt.h
index 01ca336c5..021d0613a 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -238,6 +238,11 @@ struct strands {
 	const char	**p;
 };
 
+/*
+ * A VCL_STRANDS return value must never be NULL. Use this instead
+ */
+extern const struct strands *vrt_null_strands;
+
 /***********************************************************************
  * VCL_BLOB:
  *


More information about the varnish-commit mailing list