From 7902df12638943be7d3ee935e9837ced3c282eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 21 Sep 2023 17:44:38 +0200 Subject: [PATCH] core/dbus-path: use structured initialization in one more place --- src/core/dbus-path.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/core/dbus-path.c b/src/core/dbus-path.c index 22de551c54..ced40e70d0 100644 --- a/src/core/dbus-path.c +++ b/src/core/dbus-path.c @@ -97,7 +97,6 @@ static int bus_path_set_transient_property( if (!UNIT_WRITE_FLAGS_NOOP(flags)) { _cleanup_free_ char *k = NULL; - PathSpec *s; k = strdup(path); if (!k) @@ -105,14 +104,16 @@ static int bus_path_set_transient_property( path_simplify(k); - s = new0(PathSpec, 1); + PathSpec *s = new(PathSpec, 1); if (!s) return -ENOMEM; - s->unit = u; - s->path = TAKE_PTR(k); - s->type = t; - s->inotify_fd = -EBADF; + *s = (PathSpec) { + .unit = u, + .path = TAKE_PTR(k), + .type = t, + .inotify_fd = -EBADF, + }; LIST_PREPEND(spec, p->specs, s);