|
CHashTable 1
|
Internal methods for creating and resizing a HashTable. More...
#include <stdlib.h>#include "hash_table.h"#include "hash_table_internal.h"#include "../debugmalloc/debugmalloc.h"Functions | |
| Entry ** | create_buckets (size_t size) |
| Creates a dynamically allocated bucket array with a set size. | |
| HashTable * | hash_table_create_with_size (size_t size) |
| Creates a new dynamically allocated HashTable object with a set size. | |
| void | clear_buckets (Entry **buckets, size_t size) |
| Frees all entries inside a bucket array. | |
| size_t | calc_load_threshold_count (size_t size) |
| Precalculates the load threshold count. | |
| void | hash_table_resize (HashTable *table) |
| Resizes the HashTable. | |
Internal methods for creating and resizing a HashTable.
| size_t calc_load_threshold_count | ( | size_t | size | ) |
Precalculates the load threshold count.
To reduce calculations, this method can be used to precalculate the threshold count. This way the threshold is only calculated if the table size changes.
| size | Table size |
| void clear_buckets | ( | Entry ** | buckets, |
| size_t | size | ||
| ) |
Frees all entries inside a bucket array.
| buckets | Bucket array |
| size | Size of the bucket array |
| Entry ** create_buckets | ( | size_t | size | ) |
Creates a dynamically allocated bucket array with a set size.
| size | Table size |
| HashTable * hash_table_create_with_size | ( | size_t | size | ) |
Creates a new dynamically allocated HashTable object with a set size.
| size | Table size |
| void hash_table_resize | ( | HashTable * | table | ) |
Resizes the HashTable.
Steps:
| table | Pointer to HashTable object |