]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hash-func: change value type of string_hash_ops_free_free to void* 19736/head
authorLennart Poettering <lennart@poettering.net>
Wed, 26 May 2021 19:40:43 +0000 (21:40 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 26 May 2021 19:44:36 +0000 (21:44 +0200)
The generic string_hash_ops_free_free hash operations vtable currently
assumes the data pointer is of type char*. There's really no reason to
assume that though, we regularly store non-string data as value in a
hashmap. Hence, to accomodate for that, use void* as pointer for the
value (and keep char* for the key, as that's what
string_hash_ops_free_free is for, after all).

src/basic/hash-funcs.c

index d88df65a0dd9fb1f22e67ef0fbefbc9ff1a57c4f..608131a1c1467aecf103fdb97f6c3c1a311c88c6 100644 (file)
@@ -14,7 +14,7 @@ DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(string_hash_ops_free,
                                     char, string_hash_func, string_compare_func, free);
 DEFINE_HASH_OPS_FULL(string_hash_ops_free_free,
                      char, string_hash_func, string_compare_func, free,
-                     char, free);
+                     void, free);
 
 void path_hash_func(const char *q, struct siphash *state) {
         size_t n;