Commit 7d31e25a authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

AddRef no longer need to lookup

parent 5ba1c33e
......@@ -393,7 +393,7 @@ vcc_ParseAction(struct vcc *tl)
{
struct token *at;
struct action_table *atp;
const struct symbol *sym;
struct symbol *sym;
at = tl->t;
assert(at->tok == ID);
......
......@@ -105,7 +105,7 @@ enum symkind {
};
typedef void sym_expr_t(struct vcc *tl, struct expr **,
const struct symbol *sym, vcc_type_t);
struct symbol *sym, vcc_type_t);
typedef void sym_wildcard_t(struct vcc *, struct symbol *,
const char *, const char *);
......@@ -274,7 +274,7 @@ char *TlDup(struct vcc *tl, const char *s);
/* vcc_expr.c */
void vcc_Expr(struct vcc *tl, vcc_type_t typ);
void vcc_Expr_Call(struct vcc *tl, const struct symbol *sym);
void vcc_Expr_Call(struct vcc *tl, struct symbol *sym);
void vcc_Expr_Init(struct vcc *tl);
sym_expr_t vcc_Eval_Var;
sym_expr_t vcc_Eval_Handle;
......@@ -346,7 +346,7 @@ void vcc_ParseImport(struct vcc *tl);
void vcc_ParseNew(struct vcc *tl);
/* vcc_xref.c */
struct symbol *vcc_AddRef(struct vcc *, enum symkind);
void vcc_AddRef(struct vcc *, struct symbol *);
int vcc_CheckReferences(struct vcc *tl);
void VCC_XrefTable(struct vcc *);
......
......@@ -282,7 +282,7 @@ vcc_expr_tostring(struct vcc *tl, struct expr **e, vcc_type_t fmt)
*/
static void v_matchproto_(sym_expr_t)
vcc_Eval_Regsub(struct vcc *tl, struct expr **e, const struct symbol *sym,
vcc_Eval_Regsub(struct vcc *tl, struct expr **e, struct symbol *sym,
vcc_type_t fmt)
{
struct expr *e2;
......@@ -312,7 +312,7 @@ vcc_Eval_Regsub(struct vcc *tl, struct expr **e, const struct symbol *sym,
*/
static void v_matchproto_(sym_expr_t)
vcc_Eval_BoolConst(struct vcc *tl, struct expr **e, const struct symbol *sym,
vcc_Eval_BoolConst(struct vcc *tl, struct expr **e, struct symbol *sym,
vcc_type_t fmt)
{
......@@ -326,20 +326,19 @@ vcc_Eval_BoolConst(struct vcc *tl, struct expr **e, const struct symbol *sym,
*/
void v_matchproto_(sym_expr_t)
vcc_Eval_Handle(struct vcc *tl, struct expr **e, const struct symbol *sym,
vcc_Eval_Handle(struct vcc *tl, struct expr **e, struct symbol *sym,
vcc_type_t fmt)
{
AN(sym->rname);
vcc_AddRef(tl, sym);
if (sym->fmt != STRING && fmt == STRINGS) {
(void)vcc_AddRef(tl, sym->kind);
*e = vcc_mk_expr(STRINGS, "\"%s\"", sym->name);
(*e)->nstr = 1;
(*e)->constant |= EXPR_CONST | EXPR_STR_CONST;
} else {
vcc_ExpectVid(tl, "handle");
(void)vcc_AddRef(tl, sym->kind);
*e = vcc_mk_expr(sym->fmt, "%s", sym->rname);
(*e)->constant = EXPR_VAR;
(*e)->nstr = 1;
......@@ -353,7 +352,7 @@ vcc_Eval_Handle(struct vcc *tl, struct expr **e, const struct symbol *sym,
*/
void v_matchproto_(sym_expr_t)
vcc_Eval_Var(struct vcc *tl, struct expr **e, const struct symbol *sym,
vcc_Eval_Var(struct vcc *tl, struct expr **e, struct symbol *sym,
vcc_type_t fmt)
{
......@@ -598,7 +597,7 @@ vcc_Eval_Func(struct vcc *tl, const char *spec,
*/
void v_matchproto_(sym_expr_t)
vcc_Eval_SymFunc(struct vcc *tl, struct expr **e, const struct symbol *sym,
vcc_Eval_SymFunc(struct vcc *tl, struct expr **e, struct symbol *sym,
vcc_type_t fmt)
{
......@@ -630,7 +629,7 @@ vcc_expr4(struct vcc *tl, struct expr **e, vcc_type_t fmt)
{
struct expr *e1, *e2;
const char *ip, *sign;
const struct symbol *sym;
struct symbol *sym;
enum symkind kind;
double d;
int i;
......@@ -1264,7 +1263,7 @@ vcc_Expr(struct vcc *tl, vcc_type_t fmt)
*/
void
vcc_Expr_Call(struct vcc *tl, const struct symbol *sym)
vcc_Expr_Call(struct vcc *tl, struct symbol *sym)
{
struct expr *e;
......
......@@ -247,7 +247,7 @@ vcc_ParseFunction(struct vcc *tl)
/* Add to VCL sub */
AN(p->method);
if (p->name == NULL) {
(void)vcc_AddRef(tl, SYM_SUB);
vcc_AddRef(tl, sym);
p->name = tl->t;
}
}
......
......@@ -63,17 +63,13 @@ struct procuse {
* Keep track of definitions and references
*/
struct symbol *
vcc_AddRef(struct vcc *tl, enum symkind kind)
void
vcc_AddRef(struct vcc *tl, struct symbol *sym)
{
struct symbol *sym;
sym = VCC_SymbolTok(tl, kind, 1);
if (sym->ref_b == NULL)
sym->ref_b = tl->t;
AN(sym);
sym->nref++;
return (sym);
}
/*--------------------------------------------------------------------*/
......
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