Go to the source code of this file.
Data Structures | |
| struct | s_cf_hash |
| struct | s_cf_hashentry |
Defines | |
| #define | CF_HASH_SIZE 9 |
| #define | CF_HASH_MAX_DOUBLES 5 |
| #define | hashsize(n) ((ub4)1<<(n)) |
| #define | hashmask(n) (hashsize(n)-1) |
Typedefs | |
| typedef u_int32_t | ub4 |
| typedef u_char | ub1 |
| typedef void(* | t_cf_hash_cleanup )(void *) |
| typedef s_cf_hashentry | t_cf_hash_entry |
| typedef s_cf_hash | t_cf_hash |
Functions | |
| ub4 | lookup (register ub1 *k, register ub4 length, register ub4 level) |
| t_cf_hash * | cf_hash_new (t_cf_hash_cleanup cl) |
| int | cf_hash_set (t_cf_hash *hsh, unsigned char *key, size_t keylen, void *data, size_t datalen) |
| int | cf_hash_set_static (t_cf_hash *hsh, unsigned char *key, size_t keylen, void *data) |
| void * | cf_hash_get (t_cf_hash *hsh, unsigned char *key, size_t keylen) |
| int | cf_hash_entry_delete (t_cf_hash *hsh, unsigned char *key, size_t keylen) |
| void | cf_hash_destroy (t_cf_hash *hsh) |
Definition in file hashlib.h.
|
|
If we get more than CF_HASH_MAX_DOUBLES double hash sums, we increase the size of the hash sums and the hash table. But this is really expensive... |
|
|
Is the starting hash table size (2^9) |
|
|
this macro is used to calculate the number of bytes used for keys in the actual table size. |
|
|
this macro is used to make shorten indexes easier. It calculates the number of entries at the given table size |
|
|
this struct is used to store the infos about a hashtable instance. |
|
|
This is a destructor function type. This function type is used to destroy hash elements. |
|
|
this struct is used to store a hashtable entry. |
|
|
unified character format |
|
|
unsigned 4-byte quantities |
|
|
This function destroys a hash and frees all of its values. After this function call you have to create a new hash with cf_hash_new()!
|
|
||||||||||||||||
|
This function deletes a hash entry in a hashtable.
|
|
||||||||||||||||
|
This function looks up a hash entry in a hash table. If an entry with the key could not be found, NULL is returned.
|
|
|
This function constructs a new hash. It expects a pointer to a destructor function. This function will be called when a hash entry will be destroyed. This can happen if you call 'cf_hash_entry_delete' or if you call 'cf_hash_destroy'. You MUST NOT free the data object itself! This will be done internaly. You only should cleanup the structure if it is a complex data structure like a struct or an array of arrays.
|
|
||||||||||||||||||||||||
|
This function saves a hash entry with the given key in the hash table. It can happen that the table has to be resized, but this should not happen very often (there's one double hashvalue in a 32 bit keylen and we accept 5 double hashvalues per entry). But *when* it happens, this call is very expensive...
|
|
||||||||||||||||||||
|
This function saves a hash entry with the given key in the hash table. It can happen that the table has to be resized, but this should not happen very often (there's one double hashvalue in a 32 bit keylen and we accept 5 double hashvalues per entry). But *when* it happens, this call is very expensive... The difference between cf_hash_set() is, that cf_hash_set() makes a copy from the data and cf_hash_set_static() assumes static data which needs not to be copied and needs no free() call
|
|
||||||||||||||||
|
This function is used to generate a hash sum from a given key.
|
1.3.5