diff options
author | David Lamparter <equinox@diac24.net> | 2021-02-24 11:57:15 +0100 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2021-11-10 10:39:17 +0100 |
commit | 4894e9c12a8ee0165930900bc3c3391060108516 (patch) | |
tree | 0730ac40b162dcf5cf077cacec5cb6736352ef8c /lib/xref.c | |
parent | lib: add missing include in typerb.h (diff) | |
download | frr-4894e9c12a8ee0165930900bc3c3391060108516.tar.xz frr-4894e9c12a8ee0165930900bc3c3391060108516.zip |
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 <equinox@diac24.net>
Diffstat (limited to 'lib/xref.c')
-rw-r--r-- | lib/xref.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/xref.c b/lib/xref.c index a41f91a22..0d3549d06 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) |