diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-01-17 15:39:41 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-17 15:39:41 +0900 |
commit | 16ed53658a81bcd75e8be747c7b302092b7a21cf (patch) | |
tree | 350cb117403ba1f07f4f50270e4338b6d1c13148 /src/network/networkd-routing-policy-rule.c | |
parent | 95dd454edcfb506d9d921a259620e1e8c73ae39c (diff) | |
parent | a307a7dd3864ed0185ccb3efe31f28efcc9703fe (diff) | |
download | systemd-16ed53658a81bcd75e8be747c7b302092b7a21cf.tar.gz |
Merge pull request #18243 from ssahani/ensure-put-use
tree-wide: introduce hashmap_ensure_put() and use it
Diffstat (limited to 'src/network/networkd-routing-policy-rule.c')
-rw-r--r-- | src/network/networkd-routing-policy-rule.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/network/networkd-routing-policy-rule.c b/src/network/networkd-routing-policy-rule.c index e179ffbb9e..6e00e5f9cb 100644 --- a/src/network/networkd-routing-policy-rule.c +++ b/src/network/networkd-routing-policy-rule.c @@ -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; |