journal: context - use hashmap_ensure_put

This commit is contained in:
Susant Sahani
2021-01-18 12:16:34 +01:00
parent 08ff6fcffb
commit becee4da44
+1 -5
View File
@@ -109,10 +109,6 @@ static int client_context_new(Server *s, pid_t pid, ClientContext **ret) {
assert(pid_is_valid(pid));
assert(ret);
r = hashmap_ensure_allocated(&s->client_contexts, NULL);
if (r < 0)
return r;
r = prioq_ensure_allocated(&s->client_contexts_lru, client_context_compare);
if (r < 0)
return r;
@@ -136,7 +132,7 @@ static int client_context_new(Server *s, pid_t pid, ClientContext **ret) {
.log_ratelimit_burst = s->ratelimit_burst,
};
r = hashmap_put(s->client_contexts, PID_TO_PTR(pid), c);
r = hashmap_ensure_put(&s->client_contexts, NULL, PID_TO_PTR(pid), c);
if (r < 0)
return r;