#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include "htab.h"
#include "../error/error.h"
#include "../stdlib/assert.h"
#include "../stdlib/alloc.c"
#include "../msg.c"
#include "string_hash.c"
Classes | |
struct | _nps_htab_slot_t |
struct | nps_htab_t |
Defines | |
#define | NPS_HTAB_LOAD_FACTOR 0.25 |
#define | NPS_HTAB_CACHE_HASH 0 |
#define | NPS_HTAB_CMP(x, y) strcmp((x),(y)) |
#define | NPS_HTAB_FOREACH(h, k, v) |
Functions | |
void | nps_htab_init (nps_htab_t *h, int64_t sz) |
nps_HTAB * | nps_htab_new (int64_t sz) |
nps_HTAB * | nps_htab_new_w_free (int64_t sz, void(*free_key)(void *), void(*free_value)(void *)) |
void | nps_htab_del (nps_HTAB *in) |
int64_t | nps_htab_len (nps_HTAB *o) |
int64_t | nps_htab_alloc_size (nps_HTAB *o) |
void * | nps_htab_get (nps_HTAB *o_in, const char const *key_string) |
int | nps_htab_set (nps_HTAB *o_in, nps_error_t *err, char *restrict key_string, void *value) |
int | nps_htab_remove (nps_HTAB *o_in, const char const *restrict key_string) |
uint64_t | _nps_htab_next (nps_htab_t *h, uint64_t start) |
#define NPS_HTAB_CACHE_HASH 0 |
#define NPS_HTAB_CMP | ( | x, | |||
y | ) | strcmp((x),(y)) |
#define NPS_HTAB_FOREACH | ( | h, | |||
k, | |||||
v | ) |
for (uint64_t _nps_htab_cnt = -1; \ _nps_htab_cnt=_nps_htab_next(((nps_htab_t*)(h)),_nps_htab_cnt+1), \ ((_nps_htab_cnt < nps_htab_sizes[((nps_htab_t*)(h))->allocIx]) && \ ((k)=((nps_htab_t*)(h))->tab[_nps_htab_cnt].key, \ (v)=((nps_htab_t*)(h))->tab[_nps_htab_cnt].value,1));) \
#define NPS_HTAB_LOAD_FACTOR 0.25 |
uint64_t _nps_htab_next | ( | nps_htab_t * | h, | |
uint64_t | start | |||
) |
int64_t nps_htab_alloc_size | ( | nps_HTAB * | o | ) |
void nps_htab_del | ( | nps_HTAB * | in | ) |
void* nps_htab_get | ( | nps_HTAB * | o_in, | |
const char const * | key_string | |||
) |
void nps_htab_init | ( | nps_htab_t * | h, | |
int64_t | sz | |||
) |
int64_t nps_htab_len | ( | nps_HTAB * | o | ) |
nps_HTAB* nps_htab_new | ( | int64_t | sz | ) |
nps_HTAB* nps_htab_new_w_free | ( | int64_t | sz, | |
void(*)(void *) | free_key, | |||
void(*)(void *) | free_value | |||
) |
int nps_htab_remove | ( | nps_HTAB * | o_in, | |
const char const *restrict | key_string | |||
) |
int nps_htab_set | ( | nps_HTAB * | o_in, | |
nps_error_t * | err, | |||
char *restrict | key_string, | |||
void * | value | |||
) |