[master] 3730f544d vcc: Promote error checks to assertions

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Jun 3 06:43:05 UTC 2021


commit 3730f544db89ab487c0e0e775969edf9c12f63b6
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Jun 3 08:39:32 2021 +0200

    vcc: Promote error checks to assertions
    
    Introduced by eabe58bc6633012dd01ba8f2a131f4e8cd351b2e but soon after
    made obsolete by 9b1f1d170781ffa8a881b46455327ca9d7d5c514.

diff --git a/lib/libvcc/vcc_acl.c b/lib/libvcc/vcc_acl.c
index 724d5bfe8..557b3a21f 100644
--- a/lib/libvcc/vcc_acl.c
+++ b/lib/libvcc/vcc_acl.c
@@ -477,7 +477,6 @@ vcc_acl_emit_tokens(const struct vcc *tl, const struct acl_e *ae)
 		if (t == ae->t_mask)
 			break;
 		t = vcc_PeekTokenFrom(tl, t);
-		ERRCHK(tl);
 		AN(t);
 		sep = " ";
 	} while (ae->t_mask != NULL);
diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
index 55d311ea8..e85111178 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -739,7 +739,7 @@ vcc_expr5(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 	case ID:
 		t = tl->t;
 		t1 = vcc_PeekToken(tl);
-		ERRCHK(tl);
+		AN(t1);
 		sym = VCC_SymbolGet(tl, SYM_MAIN, SYM_NONE,
 		    SYMTAB_PARTIAL_NOERR, XREF_REF);
 		if (sym == NULL && fmt->global_pfx != NULL && t1->tok != '.') {
diff --git a/lib/libvcc/vcc_token.c b/lib/libvcc/vcc_token.c
index 77ce5c075..82ab2885f 100644
--- a/lib/libvcc/vcc_token.c
+++ b/lib/libvcc/vcc_token.c
@@ -350,15 +350,15 @@ vcc_ExpectVid(struct vcc *tl, const char *what)
 	ERRCHK(tl);
 
 	t2 = vcc_PeekToken(tl);
-	ERRCHK(tl);
+	AN(t2);
 	while (t2->tok == '.') {
 		bad = ".";
 		t2 = vcc_PeekTokenFrom(tl, t2);
-		ERRCHK(tl);
+		AN(t2);
 		if (t2->tok != ID)
 			break;
 		t2 = vcc_PeekTokenFrom(tl, t2);
-		ERRCHK(tl);
+		AN(t2);
 	}
 	if (bad == NULL)
 		bad = VCT_invalid_name(tl->t->b, tl->t->e);
diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c
index d0719ec47..496164f23 100644
--- a/lib/libvcc/vcc_vmod.c
+++ b/lib/libvcc/vcc_vmod.c
@@ -316,7 +316,7 @@ vcc_ParseImport(struct vcc *tl)
 	ExpectErr(tl, ID);		/* "vmod_name" */
 	mod = tl->t;
 	tmod = vcc_PeekTokenFrom(tl, mod);
-	ERRCHK(tl);
+	AN(tmod);
 	if (tmod->tok == ID && vcc_IdIs(tmod, "as")) {
 		vcc_NextToken(tl);		/* "vmod_name" */
 		vcc_NextToken(tl);		/* "as" */
diff --git a/lib/libvcc/vcc_xref.c b/lib/libvcc/vcc_xref.c
index cf2be5532..3e5573eb6 100644
--- a/lib/libvcc/vcc_xref.c
+++ b/lib/libvcc/vcc_xref.c
@@ -124,7 +124,7 @@ vcc_AddUses(struct vcc *tl, const struct token *t1, const struct token *t2,
 	pu->t2 = t2;
 	if (pu->t2 == NULL) {
 		pu->t2 = vcc_PeekTokenFrom(tl, t1);
-		ERRCHK(tl);
+		AN(pu->t2);
 	}
 	pu->sym = sym;
 	pu->use = use;


More information about the varnish-commit mailing list