#include "networkd-network.h"
#include "networkd-util.h"
-DEFINE_SECTION_CLEANUP_FUNCTIONS(DHCPStaticLease, dhcp_static_lease_free);
-
-DHCPStaticLease *dhcp_static_lease_free(DHCPStaticLease *static_lease) {
+static DHCPStaticLease* dhcp_static_lease_free(DHCPStaticLease *static_lease) {
if (!static_lease)
return NULL;
return mfree(static_lease);
}
+DEFINE_SECTION_CLEANUP_FUNCTIONS(DHCPStaticLease, dhcp_static_lease_free);
+
+DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
+ static_lease_hash_ops_by_section,
+ ConfigSection, config_section_hash_func, config_section_compare_func,
+ DHCPStaticLease, dhcp_static_lease_free);
+
static int dhcp_static_lease_new(DHCPStaticLease **ret) {
DHCPStaticLease *p;
static_lease->network = network;
static_lease->section = TAKE_PTR(n);
- r = hashmap_ensure_put(&network->dhcp_static_leases_by_section, &config_section_hash_ops, static_lease->section, static_lease);
+
+ r = hashmap_ensure_put(&network->dhcp_static_leases_by_section, &static_lease_hash_ops_by_section, static_lease->section, static_lease);
if (r < 0)
return r;
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);
+ hashmap_free(network->dhcp_static_leases_by_section);
ordered_hashmap_free(network->sr_iov_by_section);
hashmap_free(network->qdiscs_by_section);
hashmap_free(network->tclasses_by_section);