Merge pull request #18299 from ssahani/ensure-put

More use of hashmap_ensure_put and ordered_hashmap_ensure_put
This commit is contained in:
Yu Watanabe
2021-01-19 08:42:26 +09:00
committed by GitHub
15 changed files with 44 additions and 108 deletions
+1 -5
View File
@@ -6069,15 +6069,11 @@ static int exec_runtime_add(
/* tmp_dir, var_tmp_dir, netns_storage_socket fds are donated on success */
r = hashmap_ensure_allocated(&m->exec_runtime_by_id, &string_hash_ops);
if (r < 0)
return r;
r = exec_runtime_allocate(&rt, id);
if (r < 0)
return r;
r = hashmap_put(m->exec_runtime_by_id, rt->id, rt);
r = hashmap_ensure_put(&m->exec_runtime_by_id, &string_hash_ops, rt->id, rt);
if (r < 0)
return r;