[master] 1c6237834 vcc: Emit HEADER C symbols in a dedicated function
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Mon Aug 28 13:02:06 UTC 2023
commit 1c6237834e2b4fcfe97d7d5fd73b5a209a18e4b7
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Mon May 30 06:24:33 2022 +0200
vcc: Emit HEADER C symbols in a dedicated function
It turns out we no longer need the VSB at this point since it is
equivalent to the symbol's rname.
diff --git a/lib/libvcc/vcc_var.c b/lib/libvcc/vcc_var.c
index 8257f1eb5..cfa3fec4c 100644
--- a/lib/libvcc/vcc_var.c
+++ b/lib/libvcc/vcc_var.c
@@ -40,6 +40,29 @@
/*--------------------------------------------------------------------*/
+static void
+vcc_Header_Fh(struct vcc *tl, struct symbol *sym)
+{
+ const struct symbol *parent;
+
+ AN(tl);
+ AN(sym);
+ AZ(sym->wildcard);
+ assert(sym->type == HEADER);
+
+ parent = sym->eval_priv;
+ AN(parent);
+ AN(parent->wildcard);
+ assert(parent->type == HEADER);
+
+ /* Create the static identifier */
+ Fh(tl, 0, "static const struct gethdr_s %s =\n", sym->rname + 1);
+ Fh(tl, 0, " { %s, \"\\%03o%s:\"};\n",
+ parent->rname, (unsigned int)strlen(sym->name) + 1, sym->name);
+}
+
+/*--------------------------------------------------------------------*/
+
void v_matchproto_(sym_wildcard_t)
vcc_Var_Wildcard(struct vcc *tl, struct symbol *parent, struct symbol *sym)
{
@@ -82,11 +105,6 @@ vcc_Var_Wildcard(struct vcc *tl, struct symbol *parent, struct symbol *sym)
VCC_PrintCName(vsb, sym->name, NULL);
AZ(VSB_finish(vsb));
- /* Create the static identifier */
- Fh(tl, 0, "static const struct gethdr_s %s =\n", VSB_data(vsb) + 1);
- Fh(tl, 0, " { %s, \"\\%03o%s:\"};\n",
- parent->rname, (unsigned int)strlen(sym->name) + 1, sym->name);
-
/* Create the symbol r/l values */
sym->rname = TlDup(tl, VSB_data(vsb));
@@ -104,4 +122,6 @@ vcc_Var_Wildcard(struct vcc *tl, struct symbol *parent, struct symbol *sym)
sym->uname = TlDup(tl, VSB_data(vsb));
}
VSB_destroy(&vsb);
+
+ vcc_Header_Fh(tl, sym);
}
More information about the varnish-commit
mailing list