[master] 7d31e25 AddRef no longer need to lookup
Poul-Henning Kamp
phk at FreeBSD.org
Mon Jan 29 23:21:10 UTC 2018
commit 7d31e25a7c2144c42404a4d395a72b365678a15a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Jan 29 21:17:31 2018 +0000
AddRef no longer need to lookup
diff --git a/lib/libvcc/vcc_action.c b/lib/libvcc/vcc_action.c
index 1e99ee9..998dbc2 100644
--- a/lib/libvcc/vcc_action.c
+++ b/lib/libvcc/vcc_action.c
@@ -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);
diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h
index f510e68..ec9026c 100644
--- a/lib/libvcc/vcc_compile.h
+++ b/lib/libvcc/vcc_compile.h
@@ -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 *);
diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
index 810cb1e..68c2bc7 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -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;
diff --git a/lib/libvcc/vcc_parse.c b/lib/libvcc/vcc_parse.c
index 569b3d8..666b06b 100644
--- a/lib/libvcc/vcc_parse.c
+++ b/lib/libvcc/vcc_parse.c
@@ -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;
}
}
diff --git a/lib/libvcc/vcc_xref.c b/lib/libvcc/vcc_xref.c
index 39031e8..1d6b0d7 100644
--- a/lib/libvcc/vcc_xref.c
+++ b/lib/libvcc/vcc_xref.c
@@ -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);
}
/*--------------------------------------------------------------------*/
More information about the varnish-commit
mailing list