From e942ed9b277cd8058e9ab1b5a762ee399f5231f0 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 21 May 2020 19:50:19 +0200 Subject: hash table: switch to sqfs_* types, mark functions as hidden Signed-off-by: David Oberhollenzer --- include/hash_table.h | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/include/hash_table.h b/include/hash_table.h index ccbd9c0..6f377c9 100644 --- a/include/hash_table.h +++ b/include/hash_table.h @@ -32,46 +32,51 @@ #include #include +#include "sqfs/predef.h" + struct hash_entry { - uint32_t hash; + sqfs_u32 hash; const void *key; void *data; }; struct hash_table { struct hash_entry *table; - uint32_t (*key_hash_function)(const void *key); + sqfs_u32 (*key_hash_function)(const void *key); bool (*key_equals_function)(const void *a, const void *b); const void *deleted_key; - uint32_t size; - uint32_t rehash; - uint64_t size_magic; - uint64_t rehash_magic; - uint32_t max_entries; - uint32_t size_index; - uint32_t entries; - uint32_t deleted_entries; + sqfs_u32 size; + sqfs_u32 rehash; + sqfs_u64 size_magic; + sqfs_u64 rehash_magic; + sqfs_u32 max_entries; + sqfs_u32 size_index; + sqfs_u32 entries; + sqfs_u32 deleted_entries; }; -struct hash_table * -hash_table_create(uint32_t (*key_hash_function)(const void *key), +SQFS_INTERNAL struct hash_table * +hash_table_create(sqfs_u32 (*key_hash_function)(const void *key), bool (*key_equals_function)(const void *a, const void *b)); -struct hash_table * +SQFS_INTERNAL struct hash_table * hash_table_clone(struct hash_table *src); -void hash_table_destroy(struct hash_table *ht, - void (*delete_function)(struct hash_entry *entry)); -struct hash_entry * -hash_table_insert_pre_hashed(struct hash_table *ht, uint32_t hash, +SQFS_INTERNAL void +hash_table_destroy(struct hash_table *ht, + void (*delete_function)(struct hash_entry *entry)); + +SQFS_INTERNAL struct hash_entry * +hash_table_insert_pre_hashed(struct hash_table *ht, sqfs_u32 hash, const void *key, void *data); -struct hash_entry * -hash_table_search_pre_hashed(struct hash_table *ht, uint32_t hash, + +SQFS_INTERNAL struct hash_entry * +hash_table_search_pre_hashed(struct hash_table *ht, sqfs_u32 hash, const void *key); -struct hash_entry *hash_table_next_entry(struct hash_table *ht, - struct hash_entry *entry); +SQFS_INTERNAL struct hash_entry *hash_table_next_entry(struct hash_table *ht, + struct hash_entry *entry); /** * This foreach function is safe against deletion (which just replaces -- cgit v1.2.3