From: Lennart Poettering Date: Wed, 26 May 2021 19:40:43 +0000 (+0200) Subject: hash-func: change value type of string_hash_ops_free_free to void* X-Git-Tag: v249-rc1~137^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=74bbc85ca68e2845534620bd0e60c9a6ee152c06;p=thirdparty%2Fsystemd.git hash-func: change value type of string_hash_ops_free_free to void* 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). --- diff --git a/src/basic/hash-funcs.c b/src/basic/hash-funcs.c index d88df65a0dd..608131a1c14 100644 --- a/src/basic/hash-funcs.c +++ b/src/basic/hash-funcs.c @@ -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;