network: address label - use hashmap_ensure_put
This commit is contained in:
committed by
Susant Sahani
parent
b77071b898
commit
fb8ac4cf3e
@@ -55,11 +55,7 @@ static int address_label_new_static(Network *network, const char *filename, unsi
|
||||
.section = TAKE_PTR(n),
|
||||
};
|
||||
|
||||
r = hashmap_ensure_allocated(&network->address_labels_by_section, &network_config_hash_ops);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = hashmap_put(network->address_labels_by_section, label->section, label);
|
||||
r = hashmap_ensure_put(&network->address_labels_by_section, &network_config_hash_ops, label->section, label);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user