Skip to content

Commit 1f7817f

Browse files
committed
core: use structured initialization
1 parent 1fe8427 commit 1f7817f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/core/dbus-socket.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,15 @@ static int bus_socket_set_transient_property(
351351
while ((r = sd_bus_message_read(message, "(ss)", &t, &a)) > 0) {
352352
_cleanup_free_ SocketPort *p = NULL;
353353

354-
p = new0(SocketPort, 1);
354+
p = new(SocketPort, 1);
355355
if (!p)
356356
return log_oom();
357357

358+
*p = (SocketPort) {
359+
.fd = -1,
360+
.socket = s,
361+
};
362+
358363
p->type = socket_port_type_from_string(t);
359364
if (p->type < 0)
360365
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(
387392
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Address family not supported: %s", a);
388393
}
389394

390-
p->fd = -1;
391-
p->auxiliary_fds = NULL;
392-
p->n_auxiliary_fds = 0;
393-
p->socket = s;
394-
395395
empty = false;
396396

397397
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {

0 commit comments

Comments
 (0)