diff options
author | Sami Kerola | 2019-07-01 23:02:06 +0200 |
---|---|---|
committer | Sami Kerola | 2019-07-01 23:02:06 +0200 |
commit | 5119ef0a8335a7a9e3fde2b6990ed66e2c0b5974 (patch) | |
tree | 9403eb84e4b01e68c5a9d3b8258d9e44f7441dd3 | |
parent | lsblk: force to print PKNAME for partition (diff) | |
download | kernel-qcow2-util-linux-5119ef0a8335a7a9e3fde2b6990ed66e2c0b5974.tar.gz kernel-qcow2-util-linux-5119ef0a8335a7a9e3fde2b6990ed66e2c0b5974.tar.xz kernel-qcow2-util-linux-5119ef0a8335a7a9e3fde2b6990ed66e2c0b5974.zip |
lib/ttyutils: avoid checking same thing twice
Check cols and lines are not NULL only once.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
-rw-r--r-- | lib/ttyutils.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/ttyutils.c b/lib/ttyutils.c index 166e49e11..8649f435a 100644 --- a/lib/ttyutils.c +++ b/lib/ttyutils.c @@ -47,16 +47,16 @@ int get_terminal_dimension(int *cols, int *lines) l = t_win.ts_lines; } #endif - - if (cols && c <= 0) - c = get_env_int("COLUMNS"); - if (lines && l <= 0) - l = get_env_int("LINES"); - - if (cols) + if (cols) { + if (c <= 0) + c = get_env_int("COLUMNS"); *cols = c; - if (lines) + } + if (lines) { + if (l <= 0) + l = get_env_int("LINES"); *lines = l; + } return 0; } |