Skip to content

API Document : fhash_str

Yuzhang Hu edited this page May 29, 2014 · 1 revision

fhash_str_create

fhash* fhash_str_create(uint32_t init_size, uint32_t flags)
  • brief: create fhash table
  • param: init_size The hash table index size, if it's 0, the default value 10 will be used
  • param: flags
    • FHASH_MASK_NONE: the default value, no feature enabled
    • FHASH_MASK_AUTO_REHASH: enable auto-rehash (recommended)
  • return: fhash table pointer

fhash_str_delete

void fhash_str_delete(fhash *table)
  • brief: destroy a fhash table
  • param: table pointer of fhash table
  • return: void

fhash_str_set

void fhash_str_set(fhash *table, const char *key, void *value)
  • brief: add or set a key-value pair into fhash table
  • param: table pointer of fhash table
  • param: key key
  • param: value value
  • return: void

fhash_str_get

void* fhash_str_get(fhash *table, const char *key)
  • brief: get the value of the key
  • param: table pointer of fhash table
  • param: key key
  • return: return value's pointer

fhash_str_del

void* fhash_str_del(fhash *table, const char *key)
  • brief: delete a key-value pair from the fhash table
  • param: table pointer of fhash table
  • param: key key
  • return: void

fhash_str_iter_new

fhash_str_iter fhash_str_iter_new(fhash *table)
  • brief: create a iterator of the fhash table
  • param: table pointer of fhash table
  • return: a iterator of this table

fhash_str_iter_release

void fhash_str_iter_release(fhash_str_iter *iter)
  • brief: release a iterator of the fhash table
  • param: iter a pointer of iterator
  • return: void
  • note: user must call this api if the iteration operation is done

fhash_str_next

void* fhash_str_next(fhash_str_iter *iter)
  • brief: get the next element
  • param: iter pointer of the iterator
  • return:
    • the next element
    • NULL if reach the end

fhash_str_foreach

void fhash_str_foreach(fhash *table, fhash_str_each_cb cb, void *ud)
  • brief: another iteration way
  • param: table pointer of fhash table
  • param: cb the callback function of the iteration
  • param: ud user private data, it will be passed to the callback function
  • return: void

Clone this wiki locally