tree-wide: make private hash ops static

This commit is contained in:
Mike Yuan
2026-03-04 14:32:15 +01:00
parent 11f06ab768
commit 18d1f2dced
8 changed files with 19 additions and 23 deletions
+1 -1
View File
@@ -162,7 +162,7 @@ DEFINE_HASH_OPS(
address_hash_func,
address_compare_func);
DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
address_section_hash_ops,
ConfigSection,
config_section_hash_func,
+1 -1
View File
@@ -234,7 +234,7 @@ DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(
route_compare_func,
route_unref);
DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
route_section_hash_ops,
ConfigSection,
config_section_hash_func,
+3 -6
View File
@@ -78,13 +78,10 @@ static void context_done(Context *context) {
}
DEFINE_TRIVIAL_CLEANUP_FUNC(LinkInfo*, link_info_free);
DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
link_info_hash_ops,
void,
trivial_hash_func,
trivial_compare_func,
LinkInfo,
link_info_free);
void, trivial_hash_func, trivial_compare_func,
LinkInfo, link_info_free);
static int metric_compare(sd_json_variant *const *a, sd_json_variant *const *b) {
const char *name_a, *name_b, *object_a, *object_b;
+1 -1
View File
@@ -146,7 +146,7 @@ static int stub_packet_compare_func(const DnsPacket *x, const DnsPacket *y) {
return memcmp(DNS_PACKET_HEADER(x), DNS_PACKET_HEADER(y), sizeof(DnsPacketHeader));
}
DEFINE_HASH_OPS(stub_packet_hash_ops, DnsPacket, stub_packet_hash_func, stub_packet_compare_func);
DEFINE_PRIVATE_HASH_OPS(stub_packet_hash_ops, DnsPacket, stub_packet_hash_func, stub_packet_compare_func);
static int reply_add_with_rrsig(
DnsAnswer **reply,
+1 -1
View File
@@ -328,7 +328,7 @@ static void manager_gc_hooks(Manager *m, usec_t seen_usec) {
}
}
DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
hook_hash_ops,
char, string_hash_func, string_compare_func,
Hook, hook_unlink);
+3 -6
View File
@@ -250,13 +250,10 @@ static AsyncPolkitQuery* async_polkit_query_free(AsyncPolkitQuery *q) {
DEFINE_PRIVATE_TRIVIAL_REF_UNREF_FUNC(AsyncPolkitQuery, async_polkit_query, async_polkit_query_free);
DEFINE_TRIVIAL_CLEANUP_FUNC(AsyncPolkitQuery*, async_polkit_query_unref);
DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
async_polkit_query_hash_ops,
void,
trivial_hash_func,
trivial_compare_func,
AsyncPolkitQuery,
async_polkit_query_unref);
void, trivial_hash_func, trivial_compare_func,
AsyncPolkitQuery, async_polkit_query_unref);
static int async_polkit_defer(sd_event_source *s, void *userdata) {
AsyncPolkitQuery *q = ASSERT_PTR(userdata);
+3 -3
View File
@@ -1099,9 +1099,9 @@ static JsonData* json_data_free(JsonData *d) {
DEFINE_TRIVIAL_CLEANUP_FUNC(JsonData*, json_data_free);
DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(json_data_hash_ops_free,
char, string_hash_func, string_compare_func,
JsonData, json_data_free);
DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(json_data_hash_ops_free,
char, string_hash_func, string_compare_func,
JsonData, json_data_free);
static int update_json_data(
Hashmap *h,
+6 -4
View File
@@ -184,8 +184,9 @@ static Job *job_free(Job *j) {
}
DEFINE_TRIVIAL_CLEANUP_FUNC(Job*, job_free);
DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(job_hash_ops, uint64_t, uint64_hash_func, uint64_compare_func,
Job, job_free);
DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(job_hash_ops,
uint64_t, uint64_hash_func, uint64_compare_func,
Job, job_free);
static int job_new(JobType type, Target *t, sd_bus_message *msg, JobComplete complete_cb, Job **ret) {
_cleanup_(job_freep) Job *j = NULL;
@@ -728,8 +729,9 @@ static Target *target_free(Target *t) {
}
DEFINE_TRIVIAL_CLEANUP_FUNC(Target*, target_free);
DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(target_hash_ops, char, string_hash_func, string_compare_func,
Target, target_free);
DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(target_hash_ops,
char, string_hash_func, string_compare_func,
Target, target_free);
static int target_new(Manager *m, TargetClass class, const char *name, const char *path, Target **ret) {
_cleanup_(target_freep) Target *t = NULL;