X Tutup
Skip to content

Commit 80ce54a

Browse files
committed
socket-proxy: use structured initialization in one place
1 parent add74e8 commit 80ce54a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/socket-proxy/socket-proxyd.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -480,17 +480,19 @@ static int add_connection_socket(Context *context, int fd) {
480480
log_warning_errno(r, "Unable to disable idle timer, continuing: %m");
481481
}
482482

483-
c = new0(Connection, 1);
483+
c = new(Connection, 1);
484484
if (!c) {
485485
log_oom();
486486
return 0;
487487
}
488488

489-
c->context = context;
490-
c->server_fd = fd;
491-
c->client_fd = -1;
492-
c->server_to_client_buffer[0] = c->server_to_client_buffer[1] = -1;
493-
c->client_to_server_buffer[0] = c->client_to_server_buffer[1] = -1;
489+
*c = (Connection) {
490+
.context = context,
491+
.server_fd = fd,
492+
.client_fd = -1,
493+
.server_to_client_buffer = {-1, -1},
494+
.client_to_server_buffer = {-1, -1},
495+
};
494496

495497
r = set_ensure_put(&context->connections, NULL, c);
496498
if (r < 0) {

0 commit comments

Comments
 (0)
X Tutup