]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: nexthop - use hashmap_ensure_put 18243/head
authorSusant Sahani <ssahani@vmware.com>
Thu, 14 Jan 2021 06:22:49 +0000 (07:22 +0100)
committerSusant Sahani <ssahani@vmware.com>
Sat, 16 Jan 2021 22:10:32 +0000 (23:10 +0100)
src/network/networkd-nexthop.c

index 13f532763d119ba664f57e942d79c86cd90b63be..98db2d3e3e3390c92e59d7d1c8dadbb967bfd0ab 100644 (file)
@@ -79,11 +79,7 @@ static int nexthop_new_static(Network *network, const char *filename, unsigned s
         nexthop->network = network;
         nexthop->section = TAKE_PTR(n);
 
-        r = hashmap_ensure_allocated(&network->nexthops_by_section, &network_config_hash_ops);
-        if (r < 0)
-                return r;
-
-        r = hashmap_put(network->nexthops_by_section, nexthop->section, nexthop);
+        r = hashmap_ensure_put(&network->nexthops_by_section, &network_config_hash_ops, nexthop->section, nexthop);
         if (r < 0)
                 return r;