[master] fd4d2e0b2 Provide a function to get a symbols full name
Poul-Henning Kamp
phk at FreeBSD.org
Wed May 29 09:54:11 UTC 2019
commit fd4d2e0b25a19e3333cec23391c3aa045076432b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed May 29 07:18:28 2019 +0000
Provide a function to get a symbols full name
diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h
index aa4496316..156ea816e 100644
--- a/lib/libvcc/vcc_compile.h
+++ b/lib/libvcc/vcc_compile.h
@@ -322,6 +322,7 @@ void vcc_Eval_Func(struct vcc *, const struct vjsn_val *,
const char *, const struct symbol *);
void VCC_GlobalSymbol(struct symbol *, vcc_type_t fmt, const char *pfx);
struct symbol *VCC_HandleSymbol(struct vcc *, vcc_type_t , const char *);
+void VCC_SymName(struct vsb *, const struct symbol *);
/* vcc_obj.c */
void vcc_Var_Init(struct vcc *);
diff --git a/lib/libvcc/vcc_symb.c b/lib/libvcc/vcc_symb.c
index 25a2573cb..032f9e97a 100644
--- a/lib/libvcc/vcc_symb.c
+++ b/lib/libvcc/vcc_symb.c
@@ -72,6 +72,16 @@ VCC_PrintCName(struct vsb *vsb, const char *b, const char *e)
VSB_printf(vsb, "_%02x_", *b);
}
+void
+VCC_SymName(struct vsb *vsb, const struct symbol *sym)
+{
+ if (sym->parent != NULL && sym->parent->parent != NULL) {
+ VCC_SymName(vsb, sym->parent);
+ VSB_putc(vsb, '.');
+ }
+ VSB_cat(vsb, sym->name);
+}
+
static struct symbol *
vcc_new_symbol(struct vcc *tl, const char *b, const char *e)
{
diff --git a/lib/libvcc/vcc_xref.c b/lib/libvcc/vcc_xref.c
index bfa98a6f6..dd0893c23 100644
--- a/lib/libvcc/vcc_xref.c
+++ b/lib/libvcc/vcc_xref.c
@@ -326,17 +326,6 @@ vcc_CheckUses(struct vcc *tl)
/*---------------------------------------------------------------------*/
-static void
-vcc_pnam(struct vcc *tl, const struct symbol *sym)
-{
-
- if (sym->parent != tl->symbols) {
- vcc_pnam(tl, sym->parent);
- Fc(tl, 0, ".");
- }
- Fc(tl, 0, "%s", sym->name);
-}
-
static void v_matchproto_(symwalk_f)
vcc_xreftable(struct vcc *tl, const struct symbol *sym)
{
@@ -347,7 +336,7 @@ vcc_xreftable(struct vcc *tl, const struct symbol *sym)
Fc(tl, 0, " * %-8s ", sym->kind->name);
Fc(tl, 0, " %-9s ", sym->type->name);
Fc(tl, 0, " %2u %2u ", sym->lorev, sym->hirev);
- vcc_pnam(tl, sym);
+ VCC_SymName(tl->fc, sym);
if (sym->wildcard != NULL)
Fc(tl, 0, "*");
Fc(tl, 0, "\n");
More information about the varnish-commit
mailing list