hashmap_free_with_destructor(network->bridge_mdb_entries_by_section, bridge_mdb_free);
ordered_hashmap_free(network->neighbors_by_section);
hashmap_free(network->address_labels_by_section);
- hashmap_free_with_destructor(network->prefixes_by_section, prefix_free);
- hashmap_free_with_destructor(network->route_prefixes_by_section, route_prefix_free);
- hashmap_free_with_destructor(network->pref64_prefixes_by_section, prefix64_free);
+ hashmap_free(network->prefixes_by_section);
+ hashmap_free(network->route_prefixes_by_section);
+ hashmap_free(network->pref64_prefixes_by_section);
hashmap_free(network->rules_by_section);
hashmap_free_with_destructor(network->dhcp_static_leases_by_section, dhcp_static_lease_free);
ordered_hashmap_free(network->sr_iov_by_section);
return link->network->router_prefix_delegation;
}
-Prefix* prefix_free(Prefix *prefix) {
+static Prefix* prefix_free(Prefix *prefix) {
if (!prefix)
return NULL;
DEFINE_SECTION_CLEANUP_FUNCTIONS(Prefix, prefix_free);
+DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
+ prefix_hash_ops_by_section,
+ ConfigSection, config_section_hash_func, config_section_compare_func,
+ Prefix, prefix_free);
+
static int prefix_new_static(Network *network, const char *filename, unsigned section_line, Prefix **ret) {
_cleanup_(config_section_freep) ConfigSection *n = NULL;
_cleanup_(prefix_freep) Prefix *prefix = NULL;
.prefix.preferred_until = USEC_INFINITY,
};
- r = hashmap_ensure_put(&network->prefixes_by_section, &config_section_hash_ops, prefix->section, prefix);
+ r = hashmap_ensure_put(&network->prefixes_by_section, &prefix_hash_ops_by_section, prefix->section, prefix);
if (r < 0)
return r;
return 0;
}
-RoutePrefix* route_prefix_free(RoutePrefix *prefix) {
+static RoutePrefix* route_prefix_free(RoutePrefix *prefix) {
if (!prefix)
return NULL;
DEFINE_SECTION_CLEANUP_FUNCTIONS(RoutePrefix, route_prefix_free);
+DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
+ route_prefix_hash_ops_by_section,
+ ConfigSection, config_section_hash_func, config_section_compare_func,
+ RoutePrefix, route_prefix_free);
+
static int route_prefix_new_static(Network *network, const char *filename, unsigned section_line, RoutePrefix **ret) {
_cleanup_(config_section_freep) ConfigSection *n = NULL;
_cleanup_(route_prefix_freep) RoutePrefix *prefix = NULL;
.route.valid_until = USEC_INFINITY,
};
- r = hashmap_ensure_put(&network->route_prefixes_by_section, &config_section_hash_ops, prefix->section, prefix);
+ r = hashmap_ensure_put(&network->route_prefixes_by_section, &route_prefix_hash_ops_by_section, prefix->section, prefix);
if (r < 0)
return r;
return 0;
}
-Prefix64* prefix64_free(Prefix64 *prefix) {
+static Prefix64* prefix64_free(Prefix64 *prefix) {
if (!prefix)
return NULL;
DEFINE_SECTION_CLEANUP_FUNCTIONS(Prefix64, prefix64_free);
+DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
+ prefix64_hash_ops_by_section,
+ ConfigSection, config_section_hash_func, config_section_compare_func,
+ Prefix64, prefix64_free);
+
static int prefix64_new_static(Network *network, const char *filename, unsigned section_line, Prefix64 **ret) {
_cleanup_(config_section_freep) ConfigSection *n = NULL;
_cleanup_(prefix64_freep) Prefix64 *prefix = NULL;
.prefix64.valid_until = USEC_INFINITY,
};
- r = hashmap_ensure_put(&network->pref64_prefixes_by_section, &config_section_hash_ops, prefix->section, prefix);
+ r = hashmap_ensure_put(&network->pref64_prefixes_by_section, &prefix64_hash_ops_by_section, prefix->section, prefix);
if (r < 0)
return r;
}
if (!FLAGS_SET(network->router_prefix_delegation, RADV_PREFIX_DELEGATION_STATIC)) {
- network->prefixes_by_section = hashmap_free_with_destructor(network->prefixes_by_section, prefix_free);
- network->route_prefixes_by_section = hashmap_free_with_destructor(network->route_prefixes_by_section, route_prefix_free);
- network->pref64_prefixes_by_section = hashmap_free_with_destructor(network->pref64_prefixes_by_section, prefix64_free);
+ network->prefixes_by_section = hashmap_free(network->prefixes_by_section);
+ network->route_prefixes_by_section = hashmap_free(network->route_prefixes_by_section);
+ network->pref64_prefixes_by_section = hashmap_free(network->pref64_prefixes_by_section);
}
if (!network->router_prefix_delegation)