From: Zbigniew Jędrzejewski-Szmek Date: Thu, 21 Sep 2023 15:44:38 +0000 (+0200) Subject: core/dbus-path: use structured initialization in one more place X-Git-Tag: v255-rc1~386^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7902df12638943be7d3ee935e9837ced3c282eab;p=thirdparty%2Fsystemd.git core/dbus-path: use structured initialization in one more place --- diff --git a/src/core/dbus-path.c b/src/core/dbus-path.c index 22de551c548..ced40e70d09 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);