Strophe  0.9
XMPP client library
Typedefs | Functions
hash.h File Reference

Hash table API. More...

Typedefs

typedef void(* hash_free_func) (const xmpp_ctx_t *const ctx, void *p)
 

Functions

hash_t * hash_new (xmpp_ctx_t *const ctx, const int size, hash_free_func free_func)
 allocate and initialize a new hash table More...
 
hash_t * hash_clone (hash_t *const table)
 allocate a new reference to an existing hash table More...
 
void hash_release (hash_t *const table)
 release a hash table when no longer needed More...
 
int hash_add (hash_t *table, const char *const key, void *data)
 add a key, value pair to a hash table. More...
 
void * hash_get (hash_t *table, const char *key)
 look up a key in a hash table More...
 
int hash_drop (hash_t *table, const char *key)
 delete a key from a hash table More...
 
int hash_num_keys (hash_t *table)
 return the number of keys in a hash More...
 
hash_iterator_t * hash_iter_new (hash_t *table)
 allocate and initialize a new iterator More...
 
void hash_iter_release (hash_iterator_t *iter)
 release an iterator that is no longer needed More...
 
const char * hash_iter_next (hash_iterator_t *iter)
 return the next hash table key from the iterator. More...
 

Detailed Description

Hash table API.

Typedef Documentation

◆ hash_free_func

typedef void(* hash_free_func) (const xmpp_ctx_t *const ctx, void *p)

Function Documentation

◆ hash_new()

hash_t* hash_new ( xmpp_ctx_t *const  ctx,
const int  size,
hash_free_func  free_func 
)

allocate and initialize a new hash table

◆ hash_clone()

hash_t* hash_clone ( hash_t *const  table)

allocate a new reference to an existing hash table

allocate a new reference to an existing hash table

◆ hash_release()

void hash_release ( hash_t *const  table)

release a hash table when no longer needed

release a hash table when no longer needed

◆ hash_add()

int hash_add ( hash_t *  table,
const char *const  key,
void *  data 
)

add a key, value pair to a hash table.

each key can appear only once; the value of any identical key will be replaced

◆ hash_get()

void* hash_get ( hash_t *  table,
const char *  key 
)

look up a key in a hash table

◆ hash_drop()

int hash_drop ( hash_t *  table,
const char *  key 
)

delete a key from a hash table

◆ hash_num_keys()

int hash_num_keys ( hash_t *  table)

return the number of keys in a hash

◆ hash_iter_new()

hash_iterator_t* hash_iter_new ( hash_t *  table)

allocate and initialize a new iterator

◆ hash_iter_release()

void hash_iter_release ( hash_iterator_t *  iter)

release an iterator that is no longer needed

◆ hash_iter_next()

const char* hash_iter_next ( hash_iterator_t *  iter)

return the next hash table key from the iterator.

the returned key should not be freed