]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: use structured initialization 10438/head
authorLennart Poettering <lennart@poettering.net>
Wed, 17 Oct 2018 19:06:23 +0000 (21:06 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 17 Oct 2018 19:13:02 +0000 (21:13 +0200)
src/core/dbus-socket.c

index dc87e22b2912d6096ed42c95597f00226b1af117..4ea5b6c6e599e9f907350d3a287f7ec0e47f59db 100644 (file)
@@ -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)) {