|
fr_hash_table_t * | _fr_hash_table_alloc (TALLOC_CTX *ctx, char const *type, fr_hash_t hash_func, fr_cmp_t cmp_func, fr_free_t free_func) |
|
static int | _fr_hash_table_free (fr_hash_table_t *ht) |
|
| CC_NO_UBSAN (function) |
| Find data in a hash table. More...
|
|
uint32_t | fr_hash (void const *data, size_t size) |
|
uint32_t | fr_hash_case_string (char const *p) |
| Hash a C string, converting all chars to lowercase. More...
|
|
uint32_t | fr_hash_string (char const *p) |
|
void | fr_hash_table_fill (fr_hash_table_t *ht) |
| Ensure all buckets are filled. More...
|
|
void * | fr_hash_table_find_by_key (fr_hash_table_t *ht, uint32_t key, void const *data) |
| Hash table lookup with pre-computed key. More...
|
|
static void | fr_hash_table_fixup (fr_hash_table_t *ht, uint32_t entry) |
|
int | fr_hash_table_flatten (TALLOC_CTX *ctx, void **out[], fr_hash_table_t *ht) |
| Copy all entries out of a hash table into an array. More...
|
|
static void | fr_hash_table_grow (fr_hash_table_t *ht) |
|
void * | fr_hash_table_iter_init (fr_hash_table_t *ht, fr_hash_iter_t *iter) |
| Initialise an iterator. More...
|
|
void * | fr_hash_table_iter_next (fr_hash_table_t *ht, fr_hash_iter_t *iter) |
| Iterate over entries in a hash table. More...
|
|
void | fr_hash_table_verify (fr_hash_table_t *ht) |
| Check hash table is sane. More...
|
|
uint32_t | fr_hash_update (void const *data, size_t size, uint32_t hash) |
|
static fr_hash_entry_t * | hash_table_find (fr_hash_table_t *ht, uint32_t key, void const *data) |
|
static void | list_delete (fr_hash_table_t *ht, fr_hash_entry_t **head, fr_hash_entry_t *node) |
|
static fr_hash_entry_t * | list_find (fr_hash_table_t *ht, fr_hash_entry_t *head, uint32_t reversed, void const *data) |
|
static bool | list_insert (fr_hash_table_t *ht, fr_hash_entry_t **head, fr_hash_entry_t *node) |
|
static uint32_t | parent_of (uint32_t key) |
|
static uint32_t | reverse (uint32_t key) |
|
Resizable hash tables.
The weird "reverse" function is based on an idea from "Split-Ordered Lists - Lock-free Resizable Hash Tables", with modifications so that they're not lock-free. :(
However, the split-order idea allows a fast & easy splitting of the hash bucket chain when the hash table is resized. Without it, we'd have to check & update the pointers for every node in the buck chain, rather than being able to move 1/2 of the entries in the chain with one update.
- Copyright
- 2005,2006 The FreeRADIUS server project
Definition in file hash.c.
Find data in a hash table.
Remove and free data (if a free function was specified)
Remove an entry from the hash table, without freeing the data.
Replace old data with new data, OR insert if there is no old.
Insert data into a hash table.
- Parameters
-
[in] | ht | to find data in. |
[in] | data | to find. Will be passed to the hashing function. |
- Returns
- The user data we found.
- NULL if we couldn't find any matching data.
- Parameters
-
[in] | ht | to insert data into. |
[in] | data | to insert. Will be passed to the hashing function. |
- Returns
- true if data was inserted.
- false if data already existed and was not inserted.
- Parameters
-
[out] | old | data that was replaced. If this argument is not NULL, then the old data will not be freed, even if a free function is configured. |
[in] | ht | to insert data into. |
[in] | data | to replace. Will be passed to the hashing function. |
- Returns
- 1 if data was replaced.
- 0 if data was inserted.
- -1 if we failed to replace data
- Parameters
-
[in] | ht | to remove data from. |
[in] | data | to remove. Will be passed to the hashing function. |
- Returns
- The user data we removed.
- NULL if we couldn't find any matching data.
- Parameters
-
[in] | ht | to remove data from. |
[in] | data | to remove/free. |
- Returns
- true if we removed data.
- false if we couldn't find any matching data.
Definition at line 428 of file hash.c.