[master] bbaf8aa79 Refactor

Poul-Henning Kamp phk at FreeBSD.org
Fri May 7 08:56:06 UTC 2021


commit bbaf8aa79d8e434391006b783e25a44eceb68d64
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu May 6 10:11:25 2021 +0000

    Refactor

diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index 88d558a93..a82fc9760 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -636,8 +636,6 @@ vcc_CompileSource(struct vcc *tl, struct source *sp, const char *jfile)
 	/* Register and lex the main source */
 	if (sp != NULL) {
 		AN(vcc_builtin);
-		VTAILQ_INSERT_TAIL(&tl->sources, sp, list);
-		sp->idx = tl->nsources++;
 		vcc_lex_source(tl, sp, 0);
 		if (tl->err)
 			return (NULL);
@@ -646,8 +644,6 @@ vcc_CompileSource(struct vcc *tl, struct source *sp, const char *jfile)
 	/* Register and lex the builtin VCL */
 	sp = vcc_new_source(tl->builtin_vcl, "Builtin");
 	assert(sp != NULL);
-	VTAILQ_INSERT_TAIL(&tl->sources, sp, list);
-	sp->idx = tl->nsources++;
 	vcc_lex_source(tl, sp, 1);
 	if (tl->err)
 		return (NULL);
diff --git a/lib/libvcc/vcc_source.c b/lib/libvcc/vcc_source.c
index 272e9d7cb..db953d2be 100644
--- a/lib/libvcc/vcc_source.c
+++ b/lib/libvcc/vcc_source.c
@@ -121,8 +121,6 @@ vcc_include_file(struct vcc *tl, const struct source *src_sp,
 		return (-1);
 	}
 	sp->parent = src_sp;
-	VTAILQ_INSERT_TAIL(&tl->sources, sp, list);
-	sp->idx = tl->nsources++;
 	sp->parent_tok = parent_token;
 	vcc_lex_source(tl, sp, 0);
 	return (0);
@@ -258,6 +256,9 @@ vcc_lex_source(struct vcc *tl, struct source *src_sp, int eoi)
 {
 	struct token *t;
 
+	VTAILQ_INSERT_TAIL(&tl->sources, src_sp, list);
+	src_sp->idx = tl->nsources++;
+
 	vcc_Lexer(tl, src_sp);
 	if (tl->err)
 		return;


More information about the varnish-commit mailing list