Something else that has been laying around for some time. Implemented hash_grow() that can grow a hash table to a new table size. Automatic growing is commented out in hash_insert() since there needs to be a way to disallow growing in certain cases (i.e. where no allocations can be made). This is detailed in the ToDo at the top of the file.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23074 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -28,6 +28,7 @@ struct hash_table *hash_init(uint32 table_size, int next_ptr_offset,
|
||||
int compare_func(void *element, const void *key),
|
||||
uint32 hash_func(void *element, const void *key, uint32 range));
|
||||
int hash_uninit(struct hash_table *table);
|
||||
status_t hash_grow(struct hash_table *table, uint32 newSize);
|
||||
status_t hash_insert(struct hash_table *table, void *_element);
|
||||
status_t hash_remove(struct hash_table *table, void *_element);
|
||||
void hash_remove_current(struct hash_table *table, struct hash_iterator *iterator);
|
||||
|
||||
Reference in New Issue
Block a user