From a40b421d39a64c285a4ac23304538690aaa90739 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 4 Jan 2025 14:25:44 -0800 Subject: api: Promote idhash supplemental API to core --- src/supplemental/util/idhash.c | 68 ------------------------------------------ 1 file changed, 68 deletions(-) delete mode 100644 src/supplemental/util/idhash.c (limited to 'src/supplemental/util/idhash.c') diff --git a/src/supplemental/util/idhash.c b/src/supplemental/util/idhash.c deleted file mode 100644 index 4ededa31..00000000 --- a/src/supplemental/util/idhash.c +++ /dev/null @@ -1,68 +0,0 @@ -// -// Copyright 2024 Staysail Systems, Inc. -// -// This software is supplied under the terms of the MIT License, a -// copy of which should be located in the distribution where this -// file was obtained (LICENSE.txt). A copy of the license may also be -// found online at https://opensource.org/licenses/MIT. -// - -#include -#include - -#include "core/nng_impl.h" - -struct nng_id_map_s { - nni_id_map m; -}; - -int -nng_id_map_alloc(nng_id_map **map, uint64_t lo, uint64_t hi, int flags) -{ - nng_id_map *m; - - if ((m = NNI_ALLOC_STRUCT(m)) == NULL) { - return (NNG_ENOMEM); - } - nni_id_map_init( - &m->m, lo, hi, (flags & NNG_MAP_RANDOM) ? true : false); - *map = m; - return (0); -} - -void -nng_id_map_free(nng_id_map *map) -{ - nni_id_map_fini(&map->m); - NNI_FREE_STRUCT(map); -} - -void * -nng_id_get(nng_id_map *map, uint64_t id) -{ - return (nni_id_get(&map->m, id)); -} - -int -nng_id_set(nng_id_map *map, uint64_t id, void *val) -{ - return (nni_id_set(&map->m, id, val)); -} - -int -nng_id_remove(nng_id_map *map, uint64_t id) -{ - return (nni_id_remove(&map->m, id)); -} - -int -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