chiark / gitweb /
pty: minor modernization
authorLennart Poettering <lennart@poettering.net>
Wed, 14 Jan 2015 01:22:27 +0000 (02:22 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 14 Jan 2015 22:18:33 +0000 (23:18 +0100)
We initialize structs during declartion if possible

src/shared/pty.c

index 6863be654eaa676a4f82cc12af45b6f2ebb2cecd..fbe6295ea599f57ddf0d9cbe64dd2c3d82b62b70 100644 (file)
@@ -550,16 +550,15 @@ int pty_signal(Pty *pty, int sig) {
 }
 
 int pty_resize(Pty *pty, unsigned short term_width, unsigned short term_height) {
-        struct winsize ws;
+        struct winsize ws = {
+                .ws_col = term_width,
+                .ws_row = term_height,
+        };
 
         assert_return(pty, -EINVAL);
         assert_return(pty_is_open(pty), -ENODEV);
         assert_return(pty_is_parent(pty), -ENODEV);
 
-        zero(ws);
-        ws.ws_col = term_width;
-        ws.ws_row = term_height;
-
         /*
          * This will send SIGWINCH to the pty slave foreground process group.
          * We will also get one, but we don't need it.