11 #ifndef __HASHTABLE_CWC22_H__ 12 #define __HASHTABLE_CWC22_H__ 15 #define __inline__ __inline 96 unsigned int (*hashfunction) (
void*),
97 int (*key_eq_fn) (
void*,
void*));
128 #define switch_hashtable_insert(_h, _k, _v, _f) switch_hashtable_insert_destructor(_h, _k, _v, _f, NULL) 130 #define DEFINE_HASHTABLE_INSERT(fnname, keytype, valuetype) \ 131 int fnname (switch_hashtable_t *h, keytype *k, valuetype *v) \ 133 return hashtable_insert(h,k,v); \ 148 #define DEFINE_HASHTABLE_SEARCH(fnname, keytype, valuetype) \ 149 valuetype * fnname (switch_hashtable_t *h, keytype *k) \ 151 return (valuetype *) (hashtable_search(h,k)); \ 166 #define DEFINE_HASHTABLE_REMOVE(fnname, keytype, valuetype) \ 167 valuetype * fnname (switch_hashtable_t *h, keytype *k) \ 169 return (valuetype *) (hashtable_remove(h,k)); \ 196 #define switch_hashtable_first(_h) switch_hashtable_first_iter(_h, NULL) 202 uint32_t x = *((uint32_t *)ky);
203 x = ((x >> 16) ^ x) * 0x45d9f3b;
204 x = ((x >> 16) ^ x) * 0x45d9f3b;
211 return *(uint32_t *)k1 == *(uint32_t *)k2;
216 return strcmp((
char *) k1, (
char *) k2) ? 0 : 1;
221 return strcasecmp((
char *) k1, (
char *) k2) ? 0 : 1;
226 unsigned char *str = (
unsigned char *) ky;
232 hash = c + (hash << 6) + (hash << 16) -
hash;
240 unsigned char *str = (
unsigned char *) ky;
246 hash = c + (hash << 6) + (hash << 16) -
hash;
struct switch_hashtable * h
void * switch_hashtable_search(switch_hashtable_t *h, void *k)
void(* hashtable_destructor_t)(void *ptr)
static int switch_hash_equalkeys_ci(void *k1, void *k2)
static uint32_t switch_hash_default_ci(void *ky)
switch_hashtable_iterator_t * switch_hashtable_first_iter(switch_hashtable_t *h, switch_hashtable_iterator_t *it)
int switch_hashtable_insert_destructor(switch_hashtable_t *h, void *k, void *v, hashtable_flag_t flags, hashtable_destructor_t destructor)
static uint32_t switch_hash_default_int(void *ky)
void switch_hashtable_this_val(switch_hashtable_iterator_t *i, void *val)
switch_status_t
Common return values.
switch_hashtable_iterator_t * switch_hashtable_next(switch_hashtable_iterator_t **iP)
void switch_hashtable_destroy(switch_hashtable_t **h)
switch_status_t switch_create_hashtable(switch_hashtable_t **hp, unsigned int minsize, unsigned int(*hashfunction)(void *), int(*key_eq_fn)(void *, void *))
void * switch_hashtable_remove(switch_hashtable_t *h, void *k)
static int switch_hash_equalkeys(void *k1, void *k2)
unsigned int switch_hashtable_count(switch_hashtable_t *h)
static uint32_t switch_hash_default(void *ky)
static uint32_t switch_tolower(uint32_t eax)
void switch_hashtable_this(switch_hashtable_iterator_t *i, const void **key, switch_ssize_t *klen, void **val)
static int switch_hash_equalkeys_int(void *k1, void *k2)