network: nexthop - use hashmap_ensure_put

This commit is contained in:
Susant Sahani
2021-01-16 23:10:32 +01:00
parent dcd46cc42d
commit a307a7dd38
+1 -5
View 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;