Commit bbaf8aa7 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Refactor

parent a911a136
...@@ -636,8 +636,6 @@ vcc_CompileSource(struct vcc *tl, struct source *sp, const char *jfile) ...@@ -636,8 +636,6 @@ vcc_CompileSource(struct vcc *tl, struct source *sp, const char *jfile)
/* Register and lex the main source */ /* Register and lex the main source */
if (sp != NULL) { if (sp != NULL) {
AN(vcc_builtin); AN(vcc_builtin);
VTAILQ_INSERT_TAIL(&tl->sources, sp, list);
sp->idx = tl->nsources++;
vcc_lex_source(tl, sp, 0); vcc_lex_source(tl, sp, 0);
if (tl->err) if (tl->err)
return (NULL); return (NULL);
...@@ -646,8 +644,6 @@ vcc_CompileSource(struct vcc *tl, struct source *sp, const char *jfile) ...@@ -646,8 +644,6 @@ vcc_CompileSource(struct vcc *tl, struct source *sp, const char *jfile)
/* Register and lex the builtin VCL */ /* Register and lex the builtin VCL */
sp = vcc_new_source(tl->builtin_vcl, "Builtin"); sp = vcc_new_source(tl->builtin_vcl, "Builtin");
assert(sp != NULL); assert(sp != NULL);
VTAILQ_INSERT_TAIL(&tl->sources, sp, list);
sp->idx = tl->nsources++;
vcc_lex_source(tl, sp, 1); vcc_lex_source(tl, sp, 1);
if (tl->err) if (tl->err)
return (NULL); return (NULL);
......
...@@ -121,8 +121,6 @@ vcc_include_file(struct vcc *tl, const struct source *src_sp, ...@@ -121,8 +121,6 @@ vcc_include_file(struct vcc *tl, const struct source *src_sp,
return (-1); return (-1);
} }
sp->parent = src_sp; sp->parent = src_sp;
VTAILQ_INSERT_TAIL(&tl->sources, sp, list);
sp->idx = tl->nsources++;
sp->parent_tok = parent_token; sp->parent_tok = parent_token;
vcc_lex_source(tl, sp, 0); vcc_lex_source(tl, sp, 0);
return (0); return (0);
...@@ -258,6 +256,9 @@ vcc_lex_source(struct vcc *tl, struct source *src_sp, int eoi) ...@@ -258,6 +256,9 @@ vcc_lex_source(struct vcc *tl, struct source *src_sp, int eoi)
{ {
struct token *t; struct token *t;
VTAILQ_INSERT_TAIL(&tl->sources, src_sp, list);
src_sp->idx = tl->nsources++;
vcc_Lexer(tl, src_sp); vcc_Lexer(tl, src_sp);
if (tl->err) if (tl->err)
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment