[master] a6234c3 Eliminate another double lookup

Poul-Henning Kamp phk at FreeBSD.org
Mon Jan 29 23:21:10 UTC 2018


commit a6234c328aa6b4abf21ac76a579d7f6dafcbd1ec
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jan 29 22:04:05 2018 +0000

    Eliminate another double lookup

diff --git a/lib/libvcc/vcc_action.c b/lib/libvcc/vcc_action.c
index 998dbc2..5378746 100644
--- a/lib/libvcc/vcc_action.c
+++ b/lib/libvcc/vcc_action.c
@@ -46,9 +46,9 @@ parse_call(struct vcc *tl)
 
 	vcc_NextToken(tl);
 	ExpectErr(tl, ID);
-	vcc_AddCall(tl);
 	sym = VCC_SymbolGet(tl, SYM_SUB, NULL, XREF_REF);
 	AN(sym);
+	vcc_AddCall(tl, sym);
 	VCC_GlobalSymbol(sym, SUB, "VGC_function");
 	Fb(tl, 1, "%s(ctx);\n", sym->rname);
 	vcc_NextToken(tl);
diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h
index be01f2c..40d9f1b 100644
--- a/lib/libvcc/vcc_compile.h
+++ b/lib/libvcc/vcc_compile.h
@@ -349,7 +349,7 @@ void vcc_AddRef(struct vcc *, struct symbol *);
 int vcc_CheckReferences(struct vcc *tl);
 void VCC_XrefTable(struct vcc *);
 
-void vcc_AddCall(struct vcc *);
+void vcc_AddCall(struct vcc *, struct symbol *);
 void vcc_ProcAction(struct proc *p, unsigned action, struct token *t);
 int vcc_CheckAction(struct vcc *tl);
 void vcc_AddUses(struct vcc *, const struct token *, const struct token *,
diff --git a/lib/libvcc/vcc_xref.c b/lib/libvcc/vcc_xref.c
index e6fc15b..31655dc 100644
--- a/lib/libvcc/vcc_xref.c
+++ b/lib/libvcc/vcc_xref.c
@@ -129,14 +129,14 @@ vcc_AddUses(struct vcc *tl, const struct token *t1, const struct token *t2,
 }
 
 void
-vcc_AddCall(struct vcc *tl)
+vcc_AddCall(struct vcc *tl, struct symbol *sym)
 {
 	struct proccall *pc;
 
+	AN(sym);
 	pc = TlAlloc(tl, sizeof *pc);
 	assert(pc != NULL);
-	pc->sym = VCC_SymbolTok(tl, SYM_SUB, 1);
-	AN(pc->sym);
+	pc->sym = sym;
 	pc->t = tl->t;
 	pc->fm = tl->curproc;
 	VTAILQ_INSERT_TAIL(&tl->curproc->calls, pc, list);


More information about the varnish-commit mailing list