[master] 3c5fc32 Keep the symbol table sorted, also with versioned symbols.

Poul-Henning Kamp phk at FreeBSD.org
Mon Mar 5 20:41:10 UTC 2018


commit 3c5fc3266c52acdde016788b422bd51b7f5a8541
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Mar 5 20:34:41 2018 +0000

    Keep the symbol table sorted, also with versioned symbols.
    
    Add assert to make sure it stays that way.

diff --git a/lib/libvcc/vcc_symb.c b/lib/libvcc/vcc_symb.c
index 823a53f..4d088ec 100644
--- a/lib/libvcc/vcc_symb.c
+++ b/lib/libvcc/vcc_symb.c
@@ -130,8 +130,6 @@ VCC_Symbol(struct vcc *tl, struct symbol *parent,
 	assert(l > 0);
 
 	VTAILQ_FOREACH(sym, &parent->children, list) {
-		if (sym->lorev > vhi || sym->hirev < vlo)
-			continue;
 		i = strncasecmp(sym->name, b, l);
 		if (i < 0)
 			continue;
@@ -142,6 +140,8 @@ VCC_Symbol(struct vcc *tl, struct symbol *parent,
 		}
 		if (l > sym->nlen)
 			continue;
+		if (sym->lorev > vhi || sym->hirev < vlo)
+			continue;
 		if (q < e)
 			break;
 		if ((kind == SYM_NONE && kind == sym->kind))
@@ -288,9 +288,12 @@ static void
 vcc_walksymbols(struct vcc *tl, const struct symbol *root,
     symwalk_f *func, vcc_kind_t kind)
 {
-	struct symbol *sym;
+	struct symbol *sym, *sym2 = NULL;
 
 	VTAILQ_FOREACH(sym, &root->children, list) {
+		if (sym2 != NULL)
+			assert(strcasecmp(sym->name, sym2->name) >= 0);
+		sym2 = sym;
 		if (kind == SYM_NONE || kind == sym->kind)
 			func(tl, sym);
 		ERRCHK(tl);


More information about the varnish-commit mailing list