[master] 01bea6f62 Change VRT_l_{beresp|resp}_body to take STRANDS argument
Poul-Henning Kamp
phk at FreeBSD.org
Fri Aug 20 08:22:06 UTC 2021
commit 01bea6f620f75a39ee401b11568aabe324054f1c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri Aug 20 08:20:24 2021 +0000
Change VRT_l_{beresp|resp}_body to take STRANDS argument
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index 186de5092..35ef4ee29 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -950,26 +950,18 @@ VRT_r_resp_do_esi(VRT_CTX)
#define VRT_BODY_L(which) \
VCL_VOID \
-VRT_l_##which##_body(VRT_CTX, enum lbody_e type, \
- const char *str, ...) \
+VRT_l_##which##_body(VRT_CTX, enum lbody_e type, VCL_STRANDS s) \
{ \
- va_list ap; \
- const char *p; \
+ int n; \
struct vsb *vsb; \
\
CAST_OBJ_NOTNULL(vsb, ctx->specific, VSB_MAGIC); \
assert(type == LBODY_SET || type == LBODY_ADD); \
if (type == LBODY_SET) \
VSB_clear(vsb); \
- va_start(ap, str); \
- p = str; \
- while (p != vrt_magic_string_end) { \
- if (p == NULL) \
- p = "(null)"; \
- VSB_cat(vsb, p); \
- p = va_arg(ap, const char *); \
- } \
- va_end(ap); \
+ for (n = 0; n < s->n; n++) \
+ if (s->p[n] != NULL) \
+ VSB_cat(vsb, s->p[n]); \
}
VRT_BODY_L(beresp)
diff --git a/include/vrt.h b/include/vrt.h
index b0cae3b9b..7c7264c34 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -54,6 +54,7 @@
* binary/load-time compatible, increment MAJOR version
*
* NEXT (2021-09-15)
+ * VRT_l_{beresp|resp}_body() changed to takes STRANDS argument
* VRT_SetHdr() changed to take `const char*` & `STRANDS` arguments.
* VRT_UnsetHdr() added
* vrt_magic_string_unset removed (use VRT_UnsetHdr() instead)
diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py
index c1117905a..58b1f7858 100755
--- a/lib/libvcc/generate.py
+++ b/lib/libvcc/generate.py
@@ -219,7 +219,8 @@ class vardef(object):
if self.typ == "STRING":
s += ctyp.c + ", ...)"
elif self.typ == "BODY":
- s += "enum lbody_e, " + ctyp.c + ", ...)"
+ #s += "enum lbody_e, " + ctyp.c + ", VCL_STRANDS)"
+ s += "enum lbody_e, VCL_STRANDS)"
else:
s += "VCL_" + self.typ + ")"
varproto(s)
diff --git a/lib/libvcc/vcc_action.c b/lib/libvcc/vcc_action.c
index 25e2f7a8b..fbd0cd004 100644
--- a/lib/libvcc/vcc_action.c
+++ b/lib/libvcc/vcc_action.c
@@ -121,8 +121,8 @@ static const struct assign {
{ STRING, '=', STRING_LIST },
{ HEADER, T_INCR, STRANDS, "VRT_GetHdr(ctx, \v),\n" },
{ HEADER, '=', STRANDS, "NULL,\n" },
- { BODY, '=', STRING_LIST, "LBODY_SET,\n" },
- { BODY, T_INCR, STRING_LIST, "LBODY_ADD,\n" },
+ { BODY, '=', STRANDS, "LBODY_SET,\n" },
+ { BODY, T_INCR, STRANDS, "LBODY_ADD,\n" },
{ VOID, '=', VOID }
};
More information about the varnish-commit
mailing list