summaryrefslogtreecommitdiff
path: root/scripts/kconfig/nconf.c
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2021-04-12 10:12:27 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2021-04-14 15:25:43 +0900
commit08718745d8610c2ed9870568b8d9c01b7f103efb (patch)
tree77c4c83e3cde7785df205d094b9bbb258a3d0359 /scripts/kconfig/nconf.c
parent0a94768cfda6a77c42e5373d264c96c77ef1a2e5 (diff)
downloadlinux-08718745d8610c2ed9870568b8d9c01b7f103efb.tar.gz
kconfig: nconf: refactor in print_in_middle()
This helper is the same as the sample code in the NCURSES HOWTO [1], but it is over-engineering to be used for nconf. I do not see any good reason to use the 'float' type just for the division by 2. All the call-sites pass a non-NULL pointer to the first argument, so 'if (win == NULL) win = stdscr;' is dead code. 'if (startx != 0) x = startx;' is dead code because 'x' will be overridden some lines below, by 'x = startx + (int)temp;'. All the call-sites pass a non-zero value to the second argument, so 'if (starty != 0)' is always true. getyx(win, y, x) is also dead-code because both 'y' and 'x' are overridden. All the call-sites pass 0 to the third parameter, so 'startx' can be removed. All the call-sites pass a non-zero value to the fourth parameter, so 'if (width == 0) width = 80;' is dead code. The window will be refreshed later, so there is no need to call refresh() in this function. Change the type of the last parameter from 'chtype' to 'int' to be aligned with the prototype, 'int wattrset(WINDOW *win, int attrs);' I also slightly cleaned up the indentation style. [1]: https://tldp.org/HOWTO/NCURSES-Programming-HOWTO/color.html Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/kconfig/nconf.c')
-rw-r--r--scripts/kconfig/nconf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 5209a18eeacb..b11b75f83f7e 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -953,7 +953,7 @@ static void show_menu(const char *prompt, const char *instructions,
current_instructions = instructions;
clear();
- print_in_middle(stdscr, 1, 0, getmaxx(stdscr),
+ print_in_middle(stdscr, 1, getmaxx(stdscr),
menu_backtitle,
attr_main_heading);