network: routing policy rule - Use hashmap_ensure_put
This commit is contained in:
committed by
Susant Sahani
parent
ecd80ce26c
commit
7a0c0e0e41
@@ -100,11 +100,7 @@ static int routing_policy_rule_new_static(Network *network, const char *filename
|
||||
rule->section = TAKE_PTR(n);
|
||||
rule->protocol = RTPROT_STATIC;
|
||||
|
||||
r = hashmap_ensure_allocated(&network->rules_by_section, &network_config_hash_ops);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = hashmap_put(network->rules_by_section, rule->section, rule);
|
||||
r = hashmap_ensure_put(&network->rules_by_section, &network_config_hash_ops, rule->section, rule);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user