15 #ifndef included_clib_mhash_h 16 #define included_clib_mhash_h 61 #define MHASH_VEC_STRING_KEY 0 62 #define MHASH_C_STRING_KEY 1 113 return p ? &p->
value[0] : 0;
159 #define mhash_foreach(k,v,mh,body) \ 161 hash_pair_t * _mhash_foreach_p; \ 162 hash_foreach_pair (_mhash_foreach_p, (mh)->hash, ({ \ 163 (k) = mhash_key_to_mem ((mh), _mhash_foreach_p->key); \ 164 (v) = &_mhash_foreach_p->value[0]; \ #define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static uword mhash_value_bytes(mhash_t *m)
hash_pair_t * mhash_get_pair(mhash_t *h, const void *key)
format_function_t * format_key
static void mhash_init_vec_string(mhash_t *h, uword n_value_bytes)
static uword mhash_key_vector_is_heap(mhash_t *h)
void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static uword hash_value_bytes(hash_t *h)
static hash_t * hash_header(void *v)
format_function_t format_mhash_key
static uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
u32 * key_vector_free_indices
uword mhash_unset(mhash_t *h, void *key, uword *old_value)
static void mhash_init_c_string(mhash_t *h, uword n_value_bytes)
#define vec_free(V)
Free vector's memory (no header).
static uword mhash_elts(mhash_t *m)
static uword hash_elts(void *v)
static uword * mhash_get(mhash_t *h, const void *key)
static void mhash_free(mhash_t *h)
static_always_inline uword os_get_thread_index(void)
static uword mhash_unset_key(mhash_t *h, uword key, uword *old_value)
static void * mhash_key_to_mem(mhash_t *h, uword key)
#define MHASH_C_STRING_KEY
uword mhash_set_mem(mhash_t *h, void *key, uword *new_value, uword *old_value)
#define MHASH_VEC_STRING_KEY