network: Use ordered_hashmap_ensure_put (#18233)

This commit is contained in:
Susant Sahani
2021-01-17 20:07:02 +09:00
committed by GitHub
parent f9ead1a2f4
commit ebffea2a25
8 changed files with 19 additions and 46 deletions
+1 -5
View File
@@ -85,11 +85,7 @@ static int l2tp_session_new_static(L2tpTunnel *t, const char *filename, unsigned
.section = TAKE_PTR(n),
};
r = ordered_hashmap_ensure_allocated(&t->sessions_by_section, &network_config_hash_ops);
if (r < 0)
return r;
r = ordered_hashmap_put(t->sessions_by_section, s->section, s);
r = ordered_hashmap_ensure_put(&t->sessions_by_section, &network_config_hash_ops, s->section, s);
if (r < 0)
return r;