ELinks 0.18.0
hash Struct Reference

#include <hash.h>

Collaboration diagram for hash:

Data Fields

unsigned int width
 Number of bits - hash array must be 2^width long.
hash_func_T func
struct list_head hash [1]
 Must be at end !

(Note that these are not member symbols.)

struct hashinit_hash8 (void)
void free_hash (struct hash **hashp)
struct hash_itemadd_hash_item (struct hash *hash, const char *key, unsigned int keylen, void *value)
struct hash_itemget_hash_item (struct hash *hash, const char *key, unsigned int keylen)
void del_hash_item (struct hash *hash, struct hash_item *item)
 Delete item from hash.
#define foreach_hash_item(item, hash_table, iterator)

◆ add_hash_item()

struct hash_item * add_hash_item ( struct hash * hash,
const char * key,
unsigned int keylen,
void * value )
related
Returns
hash_item if ok, NULL if error.

◆ del_hash_item()

void del_hash_item ( struct hash * hash,
struct hash_item * item )
related

Delete item from hash.

If key and/or value were dynamically allocated, think about freeing them. This function doesn't do that.

◆ foreach_hash_item

#define foreach_hash_item ( item,
hash_table,
iterator )
related
Value:
for (iterator = 0; iterator < (1 << (hash_table).width); iterator++) \
foreach (item, (hash_table).hash[iterator])
struct list_head hash[1]
Must be at end !
Definition hash.h:27

◆ free_hash()

void free_hash ( struct hash ** hashp)
related

◆ get_hash_item()

struct hash_item * get_hash_item ( struct hash * hash,
const char * key,
unsigned int keylen )
related

◆ init_hash8()

struct hash * init_hash8 ( void )
related

Field Documentation

◆ func

hash_func_T hash::func

◆ hash

struct list_head hash::hash[1]

Must be at end !

◆ width

unsigned int hash::width

Number of bits - hash array must be 2^width long.


The documentation for this struct was generated from the following files: