[master] 282239e Generalize the mechanism for predefining symbols in VCC

Poul-Henning Kamp phk at FreeBSD.org
Tue Aug 16 11:20:15 CEST 2016


commit 282239e054162c304dc82a7aa924d83531e483d6
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Aug 15 17:44:01 2016 +0000

    Generalize the mechanism for predefining symbols in VCC

diff --git a/bin/varnishd/mgt/mgt_vcc.c b/bin/varnishd/mgt/mgt_vcc.c
index 6e416c4..22a8842 100644
--- a/bin/varnishd/mgt/mgt_vcc.c
+++ b/bin/varnishd/mgt/mgt_vcc.c
@@ -104,8 +104,8 @@ run_vcc(void *priv)
 	VCC_Allow_InlineC(vcc, mgt_vcc_allow_inline_c);
 	VCC_Unsafe_Path(vcc, mgt_vcc_unsafe_path);
 	VTAILQ_FOREACH(stv, &stv_stevedores, list)
-		VCC_Stevedore(vcc, stv->ident);
-	VCC_Stevedore(vcc, stv_transient->ident);
+		VCC_Predef(vcc, "VCL_STEVEDORE", stv->ident);
+	VCC_Predef(vcc, "VCL_STEVEDORE", stv_transient->ident);
 	csrc = VCC_Compile(vcc, &sb, vp->vclsrc, vp->vclsrcfile);
 	AZ(VSB_finish(sb));
 	if (VSB_len(sb))
diff --git a/include/libvcc.h b/include/libvcc.h
index ad4bfdf..1a5125f 100644
--- a/include/libvcc.h
+++ b/include/libvcc.h
@@ -34,10 +34,10 @@ struct vcc *VCC_New(void);
 void VCC_Allow_InlineC(struct vcc *, unsigned);
 void VCC_Builtin_VCL(struct vcc *, const char *);
 void VCC_Err_Unref(struct vcc *, unsigned);
-void VCC_Stevedore(struct vcc *, const char *);
 void VCC_Unsafe_Path(struct vcc *, unsigned);
 void VCC_VCL_path(struct vcc *, const char *);
 void VCC_VMOD_path(struct vcc *, const char *);
+void VCC_Predef(struct vcc *, const char *type, const char *name);
 
 struct vsb *VCC_Compile(struct vcc *, struct vsb **,
     const char *vclsrc, const char *vclsrcfile);
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index fc6d346..8c3bf24 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -806,3 +806,14 @@ VCC_Unsafe_Path(struct vcc *vcc, unsigned u)
 	CHECK_OBJ_NOTNULL(vcc, VCC_MAGIC);
 	vcc->unsafe_path = u;
 }
+
+/*--------------------------------------------------------------------
+ * Configure settings
+ */
+
+void
+VCC_Predef(struct vcc *vcc, const char *type, const char *name)
+{
+	AZ(strcmp(type, "VCL_STEVEDORE"));
+	vcc_stevedore(vcc, name);
+}
diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h
index fc263fd..0186e5e 100644
--- a/lib/libvcc/vcc_compile.h
+++ b/lib/libvcc/vcc_compile.h
@@ -300,6 +300,9 @@ void Resolve_Sockaddr(struct vcc *tl, const char *host, const char *defport,
     const char **ipv6_ascii, const char **p_ascii, int maxips,
     const struct token *t_err, const char *errid);
 
+/* vcc_storage.c */
+void vcc_stevedore(struct vcc *vcc, const char *stv_name);
+
 /* vcc_symb.c */
 struct symbol *VCC_Symbol(struct vcc *, struct symbol *,
     const char *, const char *, enum symkind, int);
diff --git a/lib/libvcc/vcc_storage.c b/lib/libvcc/vcc_storage.c
index 6187db4..ba2f33f 100644
--- a/lib/libvcc/vcc_storage.c
+++ b/lib/libvcc/vcc_storage.c
@@ -77,7 +77,7 @@ static struct stvars {
 };
 
 void
-VCC_Stevedore(struct vcc *vcc, const char *stv_name)
+vcc_stevedore(struct vcc *vcc, const char *stv_name)
 {
 	struct symbol *sym;
 	struct stvars *sv;



More information about the varnish-commit mailing list