network: route - Use hashmap_ensure_put

This commit is contained in:
Susant Sahani
2021-01-15 14:29:42 +01:00
committed by Susant Sahani
parent b9eea0a753
commit ecd80ce26c
+1 -5
View File
@@ -227,11 +227,7 @@ static int route_new_static(Network *network, const char *filename, unsigned sec
route->network = network;
route->section = TAKE_PTR(n);
r = hashmap_ensure_allocated(&network->routes_by_section, &network_config_hash_ops);
if (r < 0)
return r;
r = hashmap_put(network->routes_by_section, route->section, route);
r = hashmap_ensure_put(&network->routes_by_section, &network_config_hash_ops, route->section, route);
if (r < 0)
return r;