From 4894e9c12a8ee0165930900bc3c3391060108516 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 24 Feb 2021 11:57:15 +0100 Subject: lib: stuff xrefs into a tree for lookup ... so we can actually access by UID without searching the entire list. Signed-off-by: David Lamparter --- lib/xref.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/xref.c') diff --git a/lib/xref.c b/lib/xref.c index a41f91a228..0d3549d062 100644 --- a/lib/xref.c +++ b/lib/xref.c @@ -35,6 +35,8 @@ struct xref_block *xref_blocks; static struct xref_block **xref_block_last = &xref_blocks; +struct xrefdata_uid_head xrefdata_uid = INIT_RBTREE_UNIQ(xrefdata_uid); + static void base32(uint8_t **inpos, int *bitpos, char *out, size_t n_chars) { @@ -109,6 +111,8 @@ static void xref_add_one(const struct xref *xref) base32(&h, &bitpos, &xrefdata->uid[0], 5); xrefdata->uid[5] = '-'; base32(&h, &bitpos, &xrefdata->uid[6], 5); + + xrefdata_uid_add(&xrefdata_uid, xrefdata); } void xref_gcc_workaround(const struct xref *xref) -- cgit v1.2.3