From 1f7817f8e9db100aa5ea599bf4f964ba9c7fc08b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 17 Oct 2018 21:06:23 +0200 Subject: [PATCH] core: use structured initialization --- src/core/dbus-socket.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c index dc87e22b291..4ea5b6c6e59 100644 --- a/src/core/dbus-socket.c +++ b/src/core/dbus-socket.c @@ -351,10 +351,15 @@ static int bus_socket_set_transient_property( while ((r = sd_bus_message_read(message, "(ss)", &t, &a)) > 0) { _cleanup_free_ SocketPort *p = NULL; - p = new0(SocketPort, 1); + p = new(SocketPort, 1); if (!p) return log_oom(); + *p = (SocketPort) { + .fd = -1, + .socket = s, + }; + p->type = socket_port_type_from_string(t); if (p->type < 0) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unknown Socket type: %s", t); @@ -387,11 +392,6 @@ static int bus_socket_set_transient_property( return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Address family not supported: %s", a); } - p->fd = -1; - p->auxiliary_fds = NULL; - p->n_auxiliary_fds = 0; - p->socket = s; - empty = false; if (!UNIT_WRITE_FLAGS_NOOP(flags)) { -- 2.47.3