sysv: use structured initialization

This commit is contained in:
Lennart Poettering 2020-05-26 14:47:05 +02:00
parent c8aa4b5b86
commit 470ab28d07
1 changed files with 7 additions and 5 deletions

View File

@ -788,19 +788,21 @@ static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) {
if (!fpath)
return log_oom();
service = new0(SysvStub, 1);
service = new(SysvStub, 1);
if (!service)
return log_oom();
service->sysv_start_priority = -1;
service->name = TAKE_PTR(name);
service->path = TAKE_PTR(fpath);
*service = (SysvStub) {
.sysv_start_priority = -1,
.name = TAKE_PTR(name),
.path = TAKE_PTR(fpath),
};
r = hashmap_put(all_services, service->name, service);
if (r < 0)
return log_oom();
service = NULL;
TAKE_PTR(service);
}
}