From: Susant Sahani Date: Thu, 14 Jan 2021 06:22:49 +0000 (+0100) Subject: network: nexthop - use hashmap_ensure_put X-Git-Tag: v248-rc1~323^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a307a7dd3864ed0185ccb3efe31f28efcc9703fe;p=thirdparty%2Fsystemd.git network: nexthop - use hashmap_ensure_put --- diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c index 13f532763d1..98db2d3e3e3 100644 --- a/src/network/networkd-nexthop.c +++ b/src/network/networkd-nexthop.c @@ -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;