[master] d306cd4 GC unused code

Poul-Henning Kamp phk at FreeBSD.org
Wed Jan 24 10:22:06 UTC 2018


commit d306cd4647a436b4d45671a007d17ccc64ed1369
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jan 24 10:20:35 2018 +0000

    GC unused code

diff --git a/lib/libvcc/vcc_action.c b/lib/libvcc/vcc_action.c
index 98df6d1..1d582e2 100644
--- a/lib/libvcc/vcc_action.c
+++ b/lib/libvcc/vcc_action.c
@@ -90,7 +90,7 @@ parse_set(struct vcc *tl)
 
 	vcc_NextToken(tl);
 	ExpectErr(tl, ID);
-	sym = vcc_FindVar(tl, 1, "cannot be set");
+	sym = vcc_FindVar(tl, "cannot be set");
 	ERRCHK(tl);
 	assert(sym != NULL);
 	if (vcc_IdIs(tl->t, "bereq.body")) {
@@ -138,7 +138,7 @@ parse_unset(struct vcc *tl)
 	/* XXX: Wrong, should use VCC_Expr(HEADER) */
 	vcc_NextToken(tl);
 	ExpectErr(tl, ID);
-	sym = vcc_FindVar(tl, 1, "cannot be unset");
+	sym = vcc_FindVar(tl, "cannot be unset");
 	ERRCHK(tl);
 	assert(sym != NULL);
 	if (sym->fmt != HEADER && !vcc_IdIs(tl->t, "bereq.body")) {
diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h
index 6824ec3..00b55dd 100644
--- a/lib/libvcc/vcc_compile.h
+++ b/lib/libvcc/vcc_compile.h
@@ -345,7 +345,7 @@ vcc_type_t VCC_Type(const char *p);
 
 /* vcc_var.c */
 sym_wildcard_t vcc_Var_Wildcard;
-const struct symbol *vcc_FindVar(struct vcc *, int, const char *);
+const struct symbol *vcc_FindVar(struct vcc *, const char *);
 
 /* vcc_vmod.c */
 void vcc_ParseImport(struct vcc *tl);
diff --git a/lib/libvcc/vcc_var.c b/lib/libvcc/vcc_var.c
index 51b9897..706c5d0 100644
--- a/lib/libvcc/vcc_var.c
+++ b/lib/libvcc/vcc_var.c
@@ -96,7 +96,7 @@ vcc_Var_Wildcard(struct vcc *tl, struct symbol *parent,
 /*--------------------------------------------------------------------*/
 
 const struct symbol *
-vcc_FindVar(struct vcc *tl, int wr_access, const char *use)
+vcc_FindVar(struct vcc *tl, const char *use)
 {
 	const struct symbol *sym;
 
@@ -104,25 +104,15 @@ vcc_FindVar(struct vcc *tl, int wr_access, const char *use)
 	if (tl->err)
 		return (NULL);
 	if (sym != NULL) {
-		if (wr_access && sym->w_methods == 0) {
+		if (sym->w_methods == 0) {
 			VSB_printf(tl->sb, "Variable ");
 			vcc_ErrToken(tl, tl->t);
 			VSB_printf(tl->sb, " is read only.");
 			VSB_cat(tl->sb, "\nAt: ");
 			vcc_ErrWhere(tl, tl->t);
 			return (NULL);
-		} else if (wr_access) {
-			vcc_AddUses(tl, tl->t, sym->w_methods, use);
-		} else if (sym->r_methods == 0) {
-			VSB_printf(tl->sb, "Variable ");
-			vcc_ErrToken(tl, tl->t);
-			VSB_printf(tl->sb, " is write only.");
-			VSB_cat(tl->sb, "\nAt: ");
-			vcc_ErrWhere(tl, tl->t);
-			return (NULL);
-		} else {
-			vcc_AddUses(tl, tl->t, sym->r_methods, use);
 		}
+		vcc_AddUses(tl, tl->t, sym->w_methods, use);
 		return (sym);
 	}
 	VSB_printf(tl->sb, "Unknown variable ");


More information about the varnish-commit mailing list