]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/network/networkd-dhcp-server-static-lease.c
tree-wide: use ASSERT_PTR more
[thirdparty/systemd.git] / src / network / networkd-dhcp-server-static-lease.c
index 6acd838e2b790f24e54aca8fc5ec09dc4f4ea832..8e7eec64d17027b23d7621906eb62621a75caa26 100644 (file)
@@ -7,7 +7,7 @@
 #include "networkd-network.h"
 #include "networkd-util.h"
 
-DEFINE_NETWORK_SECTION_FUNCTIONS(DHCPStaticLease, dhcp_static_lease_free);
+DEFINE_SECTION_CLEANUP_FUNCTIONS(DHCPStaticLease, dhcp_static_lease_free);
 
 DHCPStaticLease *dhcp_static_lease_free(DHCPStaticLease *static_lease) {
         if (!static_lease)
@@ -16,7 +16,7 @@ DHCPStaticLease *dhcp_static_lease_free(DHCPStaticLease *static_lease) {
         if (static_lease->network && static_lease->section)
                 hashmap_remove(static_lease->network->dhcp_static_leases_by_section, static_lease->section);
 
-        network_config_section_free(static_lease->section);
+        config_section_free(static_lease->section);
         free(static_lease->client_id);
         return mfree(static_lease);
 }
@@ -35,7 +35,7 @@ static int dhcp_static_lease_new(DHCPStaticLease **ret) {
 }
 
 static int lease_new_static(Network *network, const char *filename, unsigned section_line, DHCPStaticLease **ret) {
-        _cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
+        _cleanup_(config_section_freep) ConfigSection *n = NULL;
         _cleanup_(dhcp_static_lease_freep) DHCPStaticLease *static_lease = NULL;
         int r;
 
@@ -44,7 +44,7 @@ static int lease_new_static(Network *network, const char *filename, unsigned sec
         assert(section_line > 0);
         assert(ret);
 
-        r = network_config_section_new(filename, section_line, &n);
+        r = config_section_new(filename, section_line, &n);
         if (r < 0)
                 return r;
 
@@ -60,7 +60,7 @@ static int lease_new_static(Network *network, const char *filename, unsigned sec
 
         static_lease->network = network;
         static_lease->section = TAKE_PTR(n);
-        r = hashmap_ensure_put(&network->dhcp_static_leases_by_section, &network_config_hash_ops, static_lease->section, static_lease);
+        r = hashmap_ensure_put(&network->dhcp_static_leases_by_section, &config_section_hash_ops, static_lease->section, static_lease);
         if (r < 0)
                 return r;
 
@@ -114,14 +114,13 @@ int config_parse_dhcp_static_lease_address(
                 void *userdata) {
 
         _cleanup_(dhcp_static_lease_free_or_set_invalidp) DHCPStaticLease *lease = NULL;
-        Network *network = userdata;
+        Network *network = ASSERT_PTR(userdata);
         union in_addr_union addr;
         int r;
 
         assert(filename);
         assert(lvalue);
         assert(rvalue);
-        assert(network);
 
         r = lease_new_static(network, filename, section_line, &lease);
         if (r < 0)
@@ -164,7 +163,7 @@ int config_parse_dhcp_static_lease_hwaddr(
                 void *userdata) {
 
         _cleanup_(dhcp_static_lease_free_or_set_invalidp) DHCPStaticLease *lease = NULL;
-        Network *network = userdata;
+        Network *network = ASSERT_PTR(userdata);
         struct ether_addr hwaddr;
         uint8_t *c;
         int r;
@@ -172,7 +171,6 @@ int config_parse_dhcp_static_lease_hwaddr(
         assert(filename);
         assert(lvalue);
         assert(rvalue);
-        assert(network);
 
         r = lease_new_static(network, filename, section_line, &lease);
         if (r < 0)