X Tutup
Skip to content

Commit 470ab28

Browse files
committed
sysv: use structured initialization
1 parent c8aa4b5 commit 470ab28

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/sysv-generator/sysv-generator.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -788,19 +788,21 @@ static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) {
788788
if (!fpath)
789789
return log_oom();
790790

791-
service = new0(SysvStub, 1);
791+
service = new(SysvStub, 1);
792792
if (!service)
793793
return log_oom();
794794

795-
service->sysv_start_priority = -1;
796-
service->name = TAKE_PTR(name);
797-
service->path = TAKE_PTR(fpath);
795+
*service = (SysvStub) {
796+
.sysv_start_priority = -1,
797+
.name = TAKE_PTR(name),
798+
.path = TAKE_PTR(fpath),
799+
};
798800

799801
r = hashmap_put(all_services, service->name, service);
800802
if (r < 0)
801803
return log_oom();
802804

803-
service = NULL;
805+
TAKE_PTR(service);
804806
}
805807
}
806808

0 commit comments

Comments
 (0)
X Tutup