My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Classes | Macros | Typedefs
uthash.h File Reference
#include <string.h>
#include <stddef.h>
#include <stdlib.h>

Go to the source code of this file.

Classes

struct  UT_hash_bucket
 
struct  UT_hash_table
 
struct  UT_hash_handle
 

Macros

#define UTHASH_VERSION   2.0.1
 
#define DECLTYPE(x)   (__typeof(x))
 
#define DECLTYPE_ASSIGN(dst, src)
 
#define uthash_fatal(msg)   exit(-1) /* fatal error (out of memory,etc) */
 
#define uthash_malloc(sz)   malloc(sz) /* malloc fcn */
 
#define uthash_free(ptr, sz)   free(ptr) /* free fcn */
 
#define uthash_strlen(s)   strlen(s)
 
#define uthash_memcmp(a, b, n)   memcmp(a,b,n)
 
#define uthash_noexpand_fyi(tbl)   /* can be defined to log noexpand */
 
#define uthash_expand_fyi(tbl)   /* can be defined to log expands */
 
#define HASH_INITIAL_NUM_BUCKETS   32U /* initial number of buckets */
 
#define HASH_INITIAL_NUM_BUCKETS_LOG2   5U /* lg2 of initial number of buckets */
 
#define HASH_BKT_CAPACITY_THRESH   10U /* expand when bucket count reaches */
 
#define ELMT_FROM_HH(tbl, hhp)   ((void*)(((char*)(hhp)) - ((tbl)->hho)))
 
#define HH_FROM_ELMT(tbl, elp)   ((UT_hash_handle *)(((char*)(elp)) + ((tbl)->hho)))
 
#define HASH_VALUE(keyptr, keylen, hashv)
 
#define HASH_FIND_BYHASHVALUE(hh, head, keyptr, keylen, hashval, out)
 
#define HASH_FIND(hh, head, keyptr, keylen, out)
 
#define HASH_BLOOM_MAKE(tbl)
 
#define HASH_BLOOM_FREE(tbl)
 
#define HASH_BLOOM_ADD(tbl, hashv)
 
#define HASH_BLOOM_TEST(tbl, hashv)   (1)
 
#define HASH_BLOOM_BYTELEN   0U
 
#define HASH_MAKE_TABLE(hh, head)
 
#define HASH_REPLACE_BYHASHVALUE_INORDER(hh, head, fieldname, keylen_in, hashval, add, replaced, cmpfcn)
 
#define HASH_REPLACE_BYHASHVALUE(hh, head, fieldname, keylen_in, hashval, add, replaced)
 
#define HASH_REPLACE(hh, head, fieldname, keylen_in, add, replaced)
 
#define HASH_REPLACE_INORDER(hh, head, fieldname, keylen_in, add, replaced, cmpfcn)
 
#define HASH_APPEND_LIST(hh, head, add)
 
#define HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, keyptr, keylen_in, hashval, add, cmpfcn)
 
#define HASH_ADD_KEYPTR_INORDER(hh, head, keyptr, keylen_in, add, cmpfcn)
 
#define HASH_ADD_BYHASHVALUE_INORDER(hh, head, fieldname, keylen_in, hashval, add, cmpfcn)   HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn)
 
#define HASH_ADD_INORDER(hh, head, fieldname, keylen_in, add, cmpfcn)   HASH_ADD_KEYPTR_INORDER(hh, head, &((add)->fieldname), keylen_in, add, cmpfcn)
 
#define HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, keyptr, keylen_in, hashval, add)
 
#define HASH_ADD_KEYPTR(hh, head, keyptr, keylen_in, add)
 
#define HASH_ADD_BYHASHVALUE(hh, head, fieldname, keylen_in, hashval, add)   HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add)
 
#define HASH_ADD(hh, head, fieldname, keylen_in, add)   HASH_ADD_KEYPTR(hh, head, &((add)->fieldname), keylen_in, add)
 
#define HASH_TO_BKT(hashv, num_bkts, bkt)
 
#define HASH_DELETE(hh, head, delptr)
 
#define HASH_FIND_STR(head, findstr, out)   HASH_FIND(hh,head,findstr,(unsigned)uthash_strlen(findstr),out)
 
#define HASH_ADD_STR(head, strfield, add)   HASH_ADD(hh,head,strfield[0],(unsigned)uthash_strlen(add->strfield),add)
 
#define HASH_REPLACE_STR(head, strfield, add, replaced)   HASH_REPLACE(hh,head,strfield[0],(unsigned)uthash_strlen(add->strfield),add,replaced)
 
#define HASH_FIND_INT(head, findint, out)   HASH_FIND(hh,head,findint,sizeof(int),out)
 
#define HASH_ADD_INT(head, intfield, add)   HASH_ADD(hh,head,intfield,sizeof(int),add)
 
#define HASH_REPLACE_INT(head, intfield, add, replaced)   HASH_REPLACE(hh,head,intfield,sizeof(int),add,replaced)
 
#define HASH_FIND_PTR(head, findptr, out)   HASH_FIND(hh,head,findptr,sizeof(void *),out)
 
#define HASH_ADD_PTR(head, ptrfield, add)   HASH_ADD(hh,head,ptrfield,sizeof(void *),add)
 
#define HASH_REPLACE_PTR(head, ptrfield, add, replaced)   HASH_REPLACE(hh,head,ptrfield,sizeof(void *),add,replaced)
 
#define HASH_DEL(head, delptr)   HASH_DELETE(hh,head,delptr)
 
#define HASH_FSCK(hh, head)
 
#define HASH_EMIT_KEY(hh, head, keyptr, fieldlen)
 
#define HASH_FCN   HASH_JEN
 
#define HASH_BER(key, keylen, hashv)
 
#define HASH_SAX(key, keylen, hashv)
 
#define HASH_FNV(key, keylen, hashv)
 
#define HASH_OAT(key, keylen, hashv)
 
#define HASH_JEN_MIX(a, b, c)
 
#define HASH_JEN(key, keylen, hashv)
 
#define get16bits(d)
 
#define HASH_SFH(key, keylen, hashv)
 
#define HASH_FIND_IN_BKT(tbl, hh, head, keyptr, keylen_in, hashval, out)
 
#define HASH_ADD_TO_BKT(head, addhh)
 
#define HASH_DEL_IN_BKT(hh, head, hh_del)
 
#define HASH_EXPAND_BUCKETS(tbl)
 
#define HASH_SORT(head, cmpfcn)   HASH_SRT(hh,head,cmpfcn)
 
#define HASH_SRT(hh, head, cmpfcn)
 
#define HASH_SELECT(hh_dst, dst, hh_src, src, cond)
 
#define HASH_CLEAR(hh, head)
 
#define HASH_OVERHEAD(hh, head)
 
#define HASH_ITER(hh, head, el, tmp)
 
#define HASH_COUNT(head)   HASH_CNT(hh,head)
 
#define HASH_CNT(hh, head)   ((head != NULL)?((head)->hh.tbl->num_items):0U)
 
#define HASH_SIGNATURE   0xa0111fe1u
 
#define HASH_BLOOM_SIGNATURE   0xb12220f2u
 

Typedefs

typedef unsigned int uint32_t
 
typedef unsigned char uint8_t
 
typedef struct UT_hash_bucket UT_hash_bucket
 
typedef struct UT_hash_table UT_hash_table
 
typedef struct UT_hash_handle UT_hash_handle
 

Macro Definition Documentation

#define DECLTYPE (   x)    (__typeof(x))

Definition at line 67 of file uthash.h.

#define DECLTYPE_ASSIGN (   dst,
  src 
)
Value:
do { \
(dst) = DECLTYPE(dst)(src); \
} while (0)
#define DECLTYPE(x)
Definition: uthash.h:67

Definition at line 77 of file uthash.h.

#define ELMT_FROM_HH (   tbl,
  hhp 
)    ((void*)(((char*)(hhp)) - ((tbl)->hho)))

Definition at line 129 of file uthash.h.

#define get16bits (   d)
Value:
((((uint32_t)(((const uint8_t *)(d))[1])) << 8) \
+(uint32_t)(((const uint8_t *)(d))[0]) )
unsigned char uint8_t
Definition: uthash.h:97
unsigned int uint32_t
Definition: uthash.h:96

Definition at line 606 of file uthash.h.

#define HASH_ADD (   hh,
  head,
  fieldname,
  keylen_in,
  add 
)    HASH_ADD_KEYPTR(hh, head, &((add)->fieldname), keylen_in, add)

Definition at line 336 of file uthash.h.

#define HASH_ADD_BYHASHVALUE (   hh,
  head,
  fieldname,
  keylen_in,
  hashval,
  add 
)    HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add)

Definition at line 333 of file uthash.h.

#define HASH_ADD_BYHASHVALUE_INORDER (   hh,
  head,
  fieldname,
  keylen_in,
  hashval,
  add,
  cmpfcn 
)    HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn)

Definition at line 297 of file uthash.h.

#define HASH_ADD_INORDER (   hh,
  head,
  fieldname,
  keylen_in,
  add,
  cmpfcn 
)    HASH_ADD_KEYPTR_INORDER(hh, head, &((add)->fieldname), keylen_in, add, cmpfcn)

Definition at line 300 of file uthash.h.

#define HASH_ADD_INT (   head,
  intfield,
  add 
)    HASH_ADD(hh,head,intfield,sizeof(int),add)

Definition at line 401 of file uthash.h.

#define HASH_ADD_KEYPTR (   hh,
  head,
  keyptr,
  keylen_in,
  add 
)
Value:
do { \
unsigned _ha_hashv; \
HASH_VALUE(keyptr, keylen_in, _ha_hashv); \
HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, keyptr, keylen_in, _ha_hashv, add); \
} while (0)
#define HASH_VALUE(keyptr, keylen, hashv)
Definition: uthash.h:133
#define HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, keyptr, keylen_in, hashval, add)
Definition: uthash.h:303

Definition at line 326 of file uthash.h.

#define HASH_ADD_KEYPTR_BYHASHVALUE (   hh,
  head,
  keyptr,
  keylen_in,
  hashval,
  add 
)
Value:
do { \
unsigned _ha_bkt; \
(add)->hh.hashv = (hashval); \
(add)->hh.key = (char*) (keyptr); \
(add)->hh.keylen = (unsigned) (keylen_in); \
if (!(head)) { \
(add)->hh.next = NULL; \
(add)->hh.prev = NULL; \
(head) = (add); \
HASH_MAKE_TABLE(hh, head); \
} else { \
(add)->hh.tbl = (head)->hh.tbl; \
HASH_APPEND_LIST(hh, head, add); \
} \
(head)->hh.tbl->num_items++; \
HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _ha_bkt); \
HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt], &(add)->hh); \
HASH_BLOOM_ADD((head)->hh.tbl, hashval); \
HASH_EMIT_KEY(hh, head, keyptr, keylen_in); \
HASH_FSCK(hh, head); \
} while (0)
#define HASH_EMIT_KEY(hh, head, keyptr, fieldlen)
Definition: uthash.h:485
#define HASH_APPEND_LIST(hh, head, add)
Definition: uthash.h:244
#define HASH_TO_BKT(hashv, num_bkts, bkt)
Definition: uthash.h:339
#define HASH_BLOOM_ADD(tbl, hashv)
Definition: uthash.h:186
#define HASH_ADD_TO_BKT(head, addhh)
Definition: uthash.h:755
#define HASH_FSCK(hh, head)
Definition: uthash.h:471
#define HASH_MAKE_TABLE(hh, head)
Definition: uthash.h:191

Definition at line 303 of file uthash.h.

#define HASH_ADD_KEYPTR_BYHASHVALUE_INORDER (   hh,
  head,
  keyptr,
  keylen_in,
  hashval,
  add,
  cmpfcn 
)

Definition at line 252 of file uthash.h.

#define HASH_ADD_KEYPTR_INORDER (   hh,
  head,
  keyptr,
  keylen_in,
  add,
  cmpfcn 
)
Value:
do { \
unsigned _hs_hashv; \
HASH_VALUE(keyptr, keylen_in, _hs_hashv); \
HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, keyptr, keylen_in, _hs_hashv, add, cmpfcn); \
} while (0)
#define HASH_VALUE(keyptr, keylen, hashv)
Definition: uthash.h:133
#define HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, keyptr, keylen_in, hashval, add, cmpfcn)
Definition: uthash.h:252

Definition at line 290 of file uthash.h.

#define HASH_ADD_PTR (   head,
  ptrfield,
  add 
)    HASH_ADD(hh,head,ptrfield,sizeof(void *),add)

Definition at line 407 of file uthash.h.

#define HASH_ADD_STR (   head,
  strfield,
  add 
)    HASH_ADD(hh,head,strfield[0],(unsigned)uthash_strlen(add->strfield),add)

Definition at line 395 of file uthash.h.

#define HASH_ADD_TO_BKT (   head,
  addhh 
)
Value:
do { \
head.count++; \
(addhh)->hh_next = head.hh_head; \
(addhh)->hh_prev = NULL; \
if (head.hh_head != NULL) { (head).hh_head->hh_prev = (addhh); } \
(head).hh_head=addhh; \
if ((head.count >= ((head.expand_mult+1U) * HASH_BKT_CAPACITY_THRESH)) \
&& ((addhh)->tbl->noexpand != 1U)) { \
HASH_EXPAND_BUCKETS((addhh)->tbl); \
} \
} while (0)
#define HASH_EXPAND_BUCKETS(tbl)
Definition: uthash.h:810
#define HASH_BKT_CAPACITY_THRESH
Definition: uthash.h:126

Definition at line 755 of file uthash.h.

#define HASH_APPEND_LIST (   hh,
  head,
  add 
)
Value:
do { \
(add)->hh.next = NULL; \
(add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail); \
(head)->hh.tbl->tail->next = (add); \
(head)->hh.tbl->tail = &((add)->hh); \
} while (0)
#define ELMT_FROM_HH(tbl, hhp)
Definition: uthash.h:129

Definition at line 244 of file uthash.h.

#define HASH_BER (   key,
  keylen,
  hashv 
)
Value:
do { \
unsigned _hb_keylen=(unsigned)keylen; \
const unsigned char *_hb_key=(const unsigned char*)(key); \
(hashv) = 0; \
while (_hb_keylen-- != 0U) { \
(hashv) = (((hashv) << 5) + (hashv)) + *_hb_key++; \
} \
} while (0)

Definition at line 496 of file uthash.h.

#define HASH_BKT_CAPACITY_THRESH   10U /* expand when bucket count reaches */

Definition at line 126 of file uthash.h.

#define HASH_BLOOM_ADD (   tbl,
  hashv 
)

Definition at line 186 of file uthash.h.

#define HASH_BLOOM_BYTELEN   0U

Definition at line 188 of file uthash.h.

#define HASH_BLOOM_FREE (   tbl)

Definition at line 185 of file uthash.h.

#define HASH_BLOOM_MAKE (   tbl)

Definition at line 184 of file uthash.h.

#define HASH_BLOOM_SIGNATURE   0xb12220f2u

Definition at line 1047 of file uthash.h.

#define HASH_BLOOM_TEST (   tbl,
  hashv 
)    (1)

Definition at line 187 of file uthash.h.

#define HASH_CLEAR (   hh,
  head 
)
Value:
do { \
if (head != NULL) { \
uthash_free((head)->hh.tbl->buckets, \
(head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket)); \
HASH_BLOOM_FREE((head)->hh.tbl); \
uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \
(head)=NULL; \
} \
} while (0)
#define uthash_free(ptr, sz)
Definition: uthash.h:107
#define HASH_BLOOM_FREE(tbl)
Definition: uthash.h:185

Definition at line 993 of file uthash.h.

#define HASH_CNT (   hh,
  head 
)    ((head != NULL)?((head)->hh.tbl->num_items):0U)

Definition at line 1023 of file uthash.h.

#define HASH_COUNT (   head)    HASH_CNT(hh,head)

Definition at line 1022 of file uthash.h.

#define HASH_DEL (   head,
  delptr 
)    HASH_DELETE(hh,head,delptr)

Definition at line 411 of file uthash.h.

#define HASH_DEL_IN_BKT (   hh,
  head,
  hh_del 
)
Value:
(head).count--; \
if ((head).hh_head == hh_del) { \
(head).hh_head = hh_del->hh_next; \
} \
if (hh_del->hh_prev) { \
hh_del->hh_prev->hh_next = hh_del->hh_next; \
} \
if (hh_del->hh_next) { \
hh_del->hh_next->hh_prev = hh_del->hh_prev; \
}

Definition at line 769 of file uthash.h.

#define HASH_DELETE (   hh,
  head,
  delptr 
)

Definition at line 356 of file uthash.h.

#define HASH_EMIT_KEY (   hh,
  head,
  keyptr,
  fieldlen 
)

Definition at line 485 of file uthash.h.

#define HASH_EXPAND_BUCKETS (   tbl)

Definition at line 810 of file uthash.h.

#define HASH_FCN   HASH_JEN

Definition at line 492 of file uthash.h.

#define HASH_FIND (   hh,
  head,
  keyptr,
  keylen,
  out 
)
Value:
do { \
unsigned _hf_hashv; \
HASH_VALUE(keyptr, keylen, _hf_hashv); \
HASH_FIND_BYHASHVALUE(hh, head, keyptr, keylen, _hf_hashv, out); \
} while (0)
#define HASH_VALUE(keyptr, keylen, hashv)
Definition: uthash.h:133
#define HASH_FIND_BYHASHVALUE(hh, head, keyptr, keylen, hashval, out)
Definition: uthash.h:138

Definition at line 150 of file uthash.h.

#define HASH_FIND_BYHASHVALUE (   hh,
  head,
  keyptr,
  keylen,
  hashval,
  out 
)
Value:
do { \
(out) = NULL; \
if (head) { \
unsigned _hf_bkt; \
HASH_TO_BKT(hashval, (head)->hh.tbl->num_buckets, _hf_bkt); \
if (HASH_BLOOM_TEST((head)->hh.tbl, hashval) != 0) { \
HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[ _hf_bkt ], keyptr, keylen, hashval, out); \
} \
} \
} while (0)
#define HASH_FIND_IN_BKT(tbl, hh, head, keyptr, keylen_in, hashval, out)
Definition: uthash.h:733
#define HASH_BLOOM_TEST(tbl, hashv)
Definition: uthash.h:187
#define HASH_TO_BKT(hashv, num_bkts, bkt)
Definition: uthash.h:339

Definition at line 138 of file uthash.h.

#define HASH_FIND_IN_BKT (   tbl,
  hh,
  head,
  keyptr,
  keylen_in,
  hashval,
  out 
)
Value:
do { \
if ((head).hh_head != NULL) { \
DECLTYPE_ASSIGN(out, ELMT_FROM_HH(tbl, (head).hh_head)); \
} else { \
(out) = NULL; \
} \
while ((out) != NULL) { \
if ((out)->hh.hashv == (hashval) && (out)->hh.keylen == (keylen_in)) { \
if (uthash_memcmp((out)->hh.key, keyptr, keylen_in) == 0) { \
break; \
} \
} \
if ((out)->hh.hh_next != NULL) { \
DECLTYPE_ASSIGN(out, ELMT_FROM_HH(tbl, (out)->hh.hh_next)); \
} else { \
(out) = NULL; \
} \
} \
} while (0)
#define uthash_memcmp(a, b, n)
Definition: uthash.h:113
#define ELMT_FROM_HH(tbl, hhp)
Definition: uthash.h:129
#define DECLTYPE_ASSIGN(dst, src)
Definition: uthash.h:77

Definition at line 733 of file uthash.h.

#define HASH_FIND_INT (   head,
  findint,
  out 
)    HASH_FIND(hh,head,findint,sizeof(int),out)

Definition at line 399 of file uthash.h.

#define HASH_FIND_PTR (   head,
  findptr,
  out 
)    HASH_FIND(hh,head,findptr,sizeof(void *),out)

Definition at line 405 of file uthash.h.

#define HASH_FIND_STR (   head,
  findstr,
  out 
)    HASH_FIND(hh,head,findstr,(unsigned)uthash_strlen(findstr),out)

Definition at line 393 of file uthash.h.

#define HASH_FNV (   key,
  keylen,
  hashv 
)
Value:
do { \
unsigned _fn_i; \
const unsigned char *_hf_key=(const unsigned char*)(key); \
hashv = 2166136261U; \
for(_fn_i=0; _fn_i < keylen; _fn_i++) { \
hashv = hashv ^ _hf_key[_fn_i]; \
hashv = hashv * 16777619U; \
} \
} while (0)

Definition at line 519 of file uthash.h.

#define HASH_FSCK (   hh,
  head 
)

Definition at line 471 of file uthash.h.

#define HASH_INITIAL_NUM_BUCKETS   32U /* initial number of buckets */

Definition at line 124 of file uthash.h.

#define HASH_INITIAL_NUM_BUCKETS_LOG2   5U /* lg2 of initial number of buckets */

Definition at line 125 of file uthash.h.

#define HASH_ITER (   hh,
  head,
  el,
  tmp 
)
Value:
for(((el)=(head)), ((tmp)=DECLTYPE(el)((head!=NULL)?(head)->hh.next:NULL)); \
(el) != NULL; ((el)=(tmp)), ((tmp)=DECLTYPE(el)((tmp!=NULL)?(tmp)->hh.next:NULL)))
#define DECLTYPE(x)
Definition: uthash.h:67

Definition at line 1016 of file uthash.h.

#define HASH_JEN (   key,
  keylen,
  hashv 
)

Definition at line 558 of file uthash.h.

#define HASH_JEN_MIX (   a,
  b,
 
)
Value:
do { \
a -= b; a -= c; a ^= ( c >> 13 ); \
b -= c; b -= a; b ^= ( a << 8 ); \
c -= a; c -= b; c ^= ( b >> 13 ); \
a -= b; a -= c; a ^= ( c >> 12 ); \
b -= c; b -= a; b ^= ( a << 16 ); \
c -= a; c -= b; c ^= ( b >> 5 ); \
a -= b; a -= c; a ^= ( c >> 3 ); \
b -= c; b -= a; b ^= ( a << 10 ); \
c -= a; c -= b; c ^= ( b >> 15 ); \
} while (0)

Definition at line 545 of file uthash.h.

#define HASH_MAKE_TABLE (   hh,
  head 
)
Value:
do { \
(head)->hh.tbl = (UT_hash_table*)uthash_malloc( \
sizeof(UT_hash_table)); \
if (!((head)->hh.tbl)) { uthash_fatal( "out of memory"); } \
memset((head)->hh.tbl, 0, sizeof(UT_hash_table)); \
(head)->hh.tbl->tail = &((head)->hh); \
(head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS; \
(head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2; \
(head)->hh.tbl->hho = (char*)(&(head)->hh) - (char*)(head); \
(head)->hh.tbl->buckets = (UT_hash_bucket*)uthash_malloc( \
if (! (head)->hh.tbl->buckets) { uthash_fatal( "out of memory"); } \
memset((head)->hh.tbl->buckets, 0, \
HASH_BLOOM_MAKE((head)->hh.tbl); \
(head)->hh.tbl->signature = HASH_SIGNATURE; \
} while (0)
#define HASH_INITIAL_NUM_BUCKETS_LOG2
Definition: uthash.h:125
#define HASH_SIGNATURE
Definition: uthash.h:1046
#define uthash_malloc(sz)
Definition: uthash.h:104
#define HASH_INITIAL_NUM_BUCKETS
Definition: uthash.h:124
#define HASH_BLOOM_MAKE(tbl)
Definition: uthash.h:184
#define uthash_fatal(msg)
Definition: uthash.h:101

Definition at line 191 of file uthash.h.

#define HASH_OAT (   key,
  keylen,
  hashv 
)
Value:
do { \
unsigned _ho_i; \
const unsigned char *_ho_key=(const unsigned char*)(key); \
hashv = 0; \
for(_ho_i=0; _ho_i < keylen; _ho_i++) { \
hashv += _ho_key[_ho_i]; \
hashv += (hashv << 10); \
hashv ^= (hashv >> 6); \
} \
hashv += (hashv << 3); \
hashv ^= (hashv >> 11); \
hashv += (hashv << 15); \
} while (0)

Definition at line 530 of file uthash.h.

#define HASH_OVERHEAD (   hh,
  head 
)
Value:
((head != NULL) ? ( \
(size_t)(((head)->hh.tbl->num_items * sizeof(UT_hash_handle)) + \
((head)->hh.tbl->num_buckets * sizeof(UT_hash_bucket)) + \
sizeof(UT_hash_table) + \
struct UT_hash_bucket UT_hash_bucket
#define HASH_BLOOM_BYTELEN
Definition: uthash.h:188

Definition at line 1004 of file uthash.h.

#define HASH_REPLACE (   hh,
  head,
  fieldname,
  keylen_in,
  add,
  replaced 
)
Value:
do { \
unsigned _hr_hashv; \
HASH_VALUE(&((add)->fieldname), keylen_in, _hr_hashv); \
HASH_REPLACE_BYHASHVALUE(hh, head, fieldname, keylen_in, _hr_hashv, add, replaced); \
} while (0)
#define HASH_VALUE(keyptr, keylen, hashv)
Definition: uthash.h:133
#define HASH_REPLACE_BYHASHVALUE(hh, head, fieldname, keylen_in, hashval, add, replaced)
Definition: uthash.h:220

Definition at line 230 of file uthash.h.

#define HASH_REPLACE_BYHASHVALUE (   hh,
  head,
  fieldname,
  keylen_in,
  hashval,
  add,
  replaced 
)
Value:
do { \
(replaced) = NULL; \
HASH_FIND_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, replaced); \
if (replaced) { \
HASH_DELETE(hh, head, replaced); \
} \
HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, add); \
} while (0)
#define HASH_FIND_BYHASHVALUE(hh, head, keyptr, keylen, hashval, out)
Definition: uthash.h:138
#define HASH_ADD_KEYPTR_BYHASHVALUE(hh, head, keyptr, keylen_in, hashval, add)
Definition: uthash.h:303
#define HASH_DELETE(hh, head, delptr)
Definition: uthash.h:356

Definition at line 220 of file uthash.h.

#define HASH_REPLACE_BYHASHVALUE_INORDER (   hh,
  head,
  fieldname,
  keylen_in,
  hashval,
  add,
  replaced,
  cmpfcn 
)
Value:
do { \
(replaced) = NULL; \
HASH_FIND_BYHASHVALUE(hh, head, &((add)->fieldname), keylen_in, hashval, replaced); \
if (replaced) { \
HASH_DELETE(hh, head, replaced); \
} \
HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, &((add)->fieldname), keylen_in, hashval, add, cmpfcn); \
} while (0)
#define HASH_FIND_BYHASHVALUE(hh, head, keyptr, keylen, hashval, out)
Definition: uthash.h:138
#define HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, head, keyptr, keylen_in, hashval, add, cmpfcn)
Definition: uthash.h:252
#define HASH_DELETE(hh, head, delptr)
Definition: uthash.h:356

Definition at line 210 of file uthash.h.

#define HASH_REPLACE_INORDER (   hh,
  head,
  fieldname,
  keylen_in,
  add,
  replaced,
  cmpfcn 
)
Value:
do { \
unsigned _hr_hashv; \
HASH_VALUE(&((add)->fieldname), keylen_in, _hr_hashv); \
HASH_REPLACE_BYHASHVALUE_INORDER(hh, head, fieldname, keylen_in, _hr_hashv, add, replaced, cmpfcn); \
} while (0)
#define HASH_VALUE(keyptr, keylen, hashv)
Definition: uthash.h:133
#define HASH_REPLACE_BYHASHVALUE_INORDER(hh, head, fieldname, keylen_in, hashval, add, replaced, cmpfcn)
Definition: uthash.h:210

Definition at line 237 of file uthash.h.

#define HASH_REPLACE_INT (   head,
  intfield,
  add,
  replaced 
)    HASH_REPLACE(hh,head,intfield,sizeof(int),add,replaced)

Definition at line 403 of file uthash.h.

#define HASH_REPLACE_PTR (   head,
  ptrfield,
  add,
  replaced 
)    HASH_REPLACE(hh,head,ptrfield,sizeof(void *),add,replaced)

Definition at line 409 of file uthash.h.

#define HASH_REPLACE_STR (   head,
  strfield,
  add,
  replaced 
)    HASH_REPLACE(hh,head,strfield[0],(unsigned)uthash_strlen(add->strfield),add,replaced)

Definition at line 397 of file uthash.h.

#define HASH_SAX (   key,
  keylen,
  hashv 
)
Value:
do { \
unsigned _sx_i; \
const unsigned char *_hs_key=(const unsigned char*)(key); \
hashv = 0; \
for(_sx_i=0; _sx_i < keylen; _sx_i++) { \
hashv ^= (hashv << 5) + (hashv >> 2) + _hs_key[_sx_i]; \
} \
} while (0)

Definition at line 509 of file uthash.h.

#define HASH_SELECT (   hh_dst,
  dst,
  hh_src,
  src,
  cond 
)

Definition at line 955 of file uthash.h.

#define HASH_SFH (   key,
  keylen,
  hashv 
)

Definition at line 609 of file uthash.h.

#define HASH_SIGNATURE   0xa0111fe1u

Definition at line 1046 of file uthash.h.

#define HASH_SORT (   head,
  cmpfcn 
)    HASH_SRT(hh,head,cmpfcn)

Definition at line 862 of file uthash.h.

#define HASH_SRT (   hh,
  head,
  cmpfcn 
)

Definition at line 863 of file uthash.h.

#define HASH_TO_BKT (   hashv,
  num_bkts,
  bkt 
)
Value:
do { \
bkt = ((hashv) & ((num_bkts) - 1U)); \
} while (0)

Definition at line 339 of file uthash.h.

#define HASH_VALUE (   keyptr,
  keylen,
  hashv 
)
Value:
do { \
HASH_FCN(keyptr, keylen, hashv); \
} while (0)
#define HASH_FCN
Definition: uthash.h:492

Definition at line 133 of file uthash.h.

#define HH_FROM_ELMT (   tbl,
  elp 
)    ((UT_hash_handle *)(((char*)(elp)) + ((tbl)->hho)))

Definition at line 131 of file uthash.h.

#define uthash_expand_fyi (   tbl)    /* can be defined to log expands */

Definition at line 120 of file uthash.h.

#define uthash_fatal (   msg)    exit(-1) /* fatal error (out of memory,etc) */

Definition at line 101 of file uthash.h.

#define uthash_free (   ptr,
  sz 
)    free(ptr) /* free fcn */

Definition at line 107 of file uthash.h.

#define uthash_malloc (   sz)    malloc(sz) /* malloc fcn */

Definition at line 104 of file uthash.h.

#define uthash_memcmp (   a,
  b,
 
)    memcmp(a,b,n)

Definition at line 113 of file uthash.h.

#define uthash_noexpand_fyi (   tbl)    /* can be defined to log noexpand */

Definition at line 117 of file uthash.h.

#define uthash_strlen (   s)    strlen(s)

Definition at line 110 of file uthash.h.

#define UTHASH_VERSION   2.0.1

Definition at line 46 of file uthash.h.

Typedef Documentation

typedef unsigned int uint32_t

Definition at line 96 of file uthash.h.

typedef unsigned char uint8_t

Definition at line 97 of file uthash.h.

typedef struct UT_hash_table UT_hash_table