From: Lennart Poettering Date: Thu, 9 Oct 2025 19:59:48 +0000 (+0200) Subject: varlink: move definition of varlink_hash_ops into common code X-Git-Tag: v259-rc1~307^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F39323%2Fhead;p=thirdparty%2Fsystemd.git varlink: move definition of varlink_hash_ops into common code This is truly useful whenever we have to deal with multiple varlink connections. --- diff --git a/src/import/importd.c b/src/import/importd.c index 8603069047a..e9923d93ade 100644 --- a/src/import/importd.c +++ b/src/import/importd.c @@ -130,8 +130,6 @@ static const char* const transfer_type_table[_TRANSFER_TYPE_MAX] = { DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(transfer_type, TransferType); -DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(varlink_hash_ops, void, trivial_hash_func, trivial_compare_func, sd_varlink, sd_varlink_unref); - static Transfer *transfer_unref(Transfer *t) { if (!t) return NULL; diff --git a/src/libsystemd/sd-varlink/varlink-util.c b/src/libsystemd/sd-varlink/varlink-util.c index be7df731437..7ae3a66af25 100644 --- a/src/libsystemd/sd-varlink/varlink-util.c +++ b/src/libsystemd/sd-varlink/varlink-util.c @@ -203,3 +203,11 @@ int varlink_check_privileged_peer(sd_varlink *vl) { return 0; } + +DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR( + varlink_hash_ops, + void, + trivial_hash_func, + trivial_compare_func, + sd_varlink, + sd_varlink_unref); diff --git a/src/libsystemd/sd-varlink/varlink-util.h b/src/libsystemd/sd-varlink/varlink-util.h index 3a340b22165..929f5b04cf7 100644 --- a/src/libsystemd/sd-varlink/varlink-util.h +++ b/src/libsystemd/sd-varlink/varlink-util.h @@ -27,3 +27,5 @@ int varlink_server_new( void *userdata); int varlink_check_privileged_peer(sd_varlink *vl); + +extern const struct hash_ops varlink_hash_ops;