journal: context - use hashmap_ensure_put
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user