[master] d548292e3 Add SYMTAB_PARTIAL_NOERR mode for VCC_SymbolGet()

Nils Goroll nils.goroll at uplex.de
Wed Feb 17 19:20:03 UTC 2021


commit d548292e3449440bac6e815b266f8611add3995b
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Feb 17 16:58:27 2021 +0100

    Add SYMTAB_PARTIAL_NOERR mode for VCC_SymbolGet()
    
    For the next commit, we need a partial lookup without error.
    
    Alternatively, we could also a an error mode.

diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h
index 2dff6dfa5..5447021e4 100644
--- a/lib/libvcc/vcc_compile.h
+++ b/lib/libvcc/vcc_compile.h
@@ -387,6 +387,7 @@ extern const struct symmode SYMTAB_NOERR[1];
 extern const struct symmode SYMTAB_CREATE[1];
 extern const struct symmode SYMTAB_EXISTING[1];
 extern const struct symmode SYMTAB_PARTIAL[1];
+extern const struct symmode SYMTAB_PARTIAL_NOERR[1];
 
 struct symbol *VCC_SymbolGet(struct vcc *, vcc_ns_t, vcc_kind_t,
     const struct symmode *, const struct symxref *);
diff --git a/lib/libvcc/vcc_symb.c b/lib/libvcc/vcc_symb.c
index 59c74228f..4df46f977 100644
--- a/lib/libvcc/vcc_symb.c
+++ b/lib/libvcc/vcc_symb.c
@@ -254,6 +254,7 @@ const struct symmode SYMTAB_NOERR[1] = {{"sym_noerror"}};
 const struct symmode SYMTAB_CREATE[1] = {{"sym_create"}};
 const struct symmode SYMTAB_EXISTING[1] = {{"Symbol not found"}};
 const struct symmode SYMTAB_PARTIAL[1] = {{"Symbol not found"}};
+const struct symmode SYMTAB_PARTIAL_NOERR[1] = {{"Symbol not found"}};
 
 struct symbol *
 VCC_SymbolGet(struct vcc *tl, vcc_ns_t ns, vcc_kind_t kind,
@@ -301,13 +302,13 @@ VCC_SymbolGet(struct vcc *tl, vcc_ns_t ns, vcc_kind_t kind,
 	}
 	if (sym != NULL && sym->kind == SYM_VMOD && e == SYMTAB_PARTIAL)
 		e = SYMTAB_EXISTING;
-	if (sym != NULL && e == SYMTAB_PARTIAL) {
+	if (sym != NULL && (e == SYMTAB_PARTIAL || e == SYMTAB_PARTIAL_NOERR)) {
 		st = st2;
 		tn = tn2;
 	} else if (st != st2) {
 		sym = NULL;
 	}
-	if (sym == NULL && e == SYMTAB_NOERR)
+	if (sym == NULL && (e == SYMTAB_NOERR || e == SYMTAB_PARTIAL_NOERR))
 		return (sym);
 	AN(st);
 	AN(tn);


More information about the varnish-commit mailing list