style: clang-format

This commit is contained in:
2025-10-24 20:18:43 +02:00
parent 167c21cb80
commit ec1ca30c75
8 changed files with 58 additions and 39 deletions

View File

@@ -7,7 +7,9 @@
/*
* @brief Returns the mutex ID.
*/
static size_t get_mutex(hashmap_s *hashmap, size_t hash) { return hash % hashmap->num_locks; }
static size_t get_mutex(hashmap_s *hashmap, size_t hash) {
return hash % hashmap->num_locks;
}
static size_t get_bucket_index(hashmap_s *hashmap, void *key) {
unsigned int hash = hashmap->hash(key);
@@ -53,7 +55,8 @@ static bucket_s *find_bucket(hashmap_s *hashmap, void *key, bucket_s **prev) {
return NULL;
}
hashmap_s *hm_new(hash_f *hash_fn, equal_f *equal_fn, free_key_f *free_key_fn, free_value_f *free_value_fn, size_t key_size, size_t value_size) {
hashmap_s *hm_new(hash_f *hash_fn, equal_f *equal_fn, free_key_f *free_key_fn,
free_value_f *free_value_fn, size_t key_size, size_t value_size) {
hashmap_s *hashmap = malloc(sizeof(hashmap_s));
if (hashmap == NULL) {
return NULL;

View File

@@ -75,7 +75,8 @@ typedef struct hashmap {
* @param[in] value_size Size in bytes of each value to be stored.
* @return A pointer to the newly initialized hash map, or NULL on failure.
*/
hashmap_s *hm_new(hash_f *hash, equal_f *equal, free_key_f *free_key, free_value_f *free_value, size_t key_size, size_t value_size);
hashmap_s *hm_new(hash_f *hash, equal_f *equal, free_key_f *free_key, free_value_f *free_value,
size_t key_size, size_t value_size);
/**
* @brief Free all resources used by the hash map.
@@ -101,7 +102,8 @@ void hm_free_bucket(bucket_s *bucket);
* @param[in] hashmap Pointer to the hash map.
* @param[in] key Pointer to the key to insert (will be copied, must not be NULL).
* @param[in] value Pointer to the value to insert (will be copied, must not be NULL).
* @return true if the operation succeeded, false on failure (NULL hashmap/key/value or memory allocation failure).
* @return true if the operation succeeded, false on failure (NULL hashmap/key/value or memory
* allocation failure).
*/
bool hm_set(hashmap_s *hashmap, void *key, void *value);