network: neighbor - use hashmap_ensure_put

This commit is contained in:
Susant Sahani
2021-01-15 14:29:42 +01:00
committed by Susant Sahani
parent f222165e3d
commit 700661ed75
+1 -5
View File
@@ -60,11 +60,7 @@ static int neighbor_new_static(Network *network, const char *filename, unsigned
.section = TAKE_PTR(n),
};
r = hashmap_ensure_allocated(&network->neighbors_by_section, &network_config_hash_ops);
if (r < 0)
return r;
r = hashmap_put(network->neighbors_by_section, neighbor->section, neighbor);
r = hashmap_ensure_put(&network->neighbors_by_section, &network_config_hash_ops, neighbor->section, neighbor);
if (r < 0)
return r;