From d3652db599cb3bf4101cf2e6cf42c764d65b6fb8 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 11 Aug 2024 22:12:30 -0700 Subject: idhash: add nng_id_visit API This allows an efficient way to iterate over the entries stored in an ID hash. The iteration is fast, and requires no additional storage. The order of iteration is not guaranteed. --- src/supplemental/util/idhash.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/supplemental/util/idhash.c') diff --git a/src/supplemental/util/idhash.c b/src/supplemental/util/idhash.c index cf48df3e..4ededa31 100644 --- a/src/supplemental/util/idhash.c +++ b/src/supplemental/util/idhash.c @@ -60,3 +60,9 @@ nng_id_alloc(nng_id_map *map, uint64_t *id, void *val) { return (nni_id_alloc(&map->m, id, val)); } + +bool +nng_id_visit(nng_id_map *map, uint64_t *id, void **valp, uint32_t *cursor) +{ + return (nni_id_visit(&map->m, id, valp, cursor)); +} -- cgit v1.2.3-70-g09d2