hashmap: Drop debug params

Passing in the func, file and line information complicates the
interface. On top of that, it prevents forward declaring Hashmap in
strv.h, as we need to pass the macros everywhere that we allocate a
hashmap, which means we have to include the hashmap header everywhere
we have a function that allocates a hashmap instead of just having to
forward declare Hashmap.

Let's drop the file, func and line information from the debug information.
Instead, in the future we can add a description field to hashmaps like we
already have in various other structs to describe the purpose of the hashmap
which should be much more useful than having the file, line and function where
the hashmap was allocated.
This commit is contained in:
Daan De Meyer
2025-05-06 10:14:26 +02:00
parent 40a6cdc29e
commit c09ce222b6
8 changed files with 85 additions and 118 deletions
+4 -4
View File
@@ -1126,28 +1126,28 @@ static int string_strv_hashmap_put_internal(Hashmap *h, const char *key, const c
return 1;
}
int _string_strv_hashmap_put(Hashmap **h, const char *key, const char *value HASHMAP_DEBUG_PARAMS) {
int string_strv_hashmap_put(Hashmap **h, const char *key, const char *value) {
int r;
assert(h);
assert(key);
assert(value);
r = _hashmap_ensure_allocated(h, &string_hash_ops_free_strv_free HASHMAP_DEBUG_PASS_ARGS);
r = hashmap_ensure_allocated(h, &string_hash_ops_free_strv_free);
if (r < 0)
return r;
return string_strv_hashmap_put_internal(*h, key, value);
}
int _string_strv_ordered_hashmap_put(OrderedHashmap **h, const char *key, const char *value HASHMAP_DEBUG_PARAMS) {
int string_strv_ordered_hashmap_put(OrderedHashmap **h, const char *key, const char *value) {
int r;
assert(h);
assert(key);
assert(value);
r = _ordered_hashmap_ensure_allocated(h, &string_hash_ops_free_strv_free HASHMAP_DEBUG_PASS_ARGS);
r = ordered_hashmap_ensure_allocated(h, &string_hash_ops_free_strv_free);
if (r < 0)
return r;