From: Federico Kircheis Date: Thu, 1 Mar 2018 17:07:43 +0000 (+0100) Subject: Reduce variable scope - curs_lib.c X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=baf61ed03e6cd08d1ab070e5e9c21e164f48c12a;p=neomutt Reduce variable scope - curs_lib.c --- diff --git a/curs_lib.c b/curs_lib.c index 581771cdf..c1a3f245e 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -730,12 +730,10 @@ static int vw_printw(SLcurses_Window_Type *win, const char *fmt, va_list ap) int mutt_window_mvprintw(struct MuttWindow *win, int row, int col, const char *fmt, ...) { - va_list ap; - int rc; - - rc = mutt_window_move(win, row, col); + int rc = mutt_window_move(win, row, col); if (rc != ERR) { + va_list ap; va_start(ap, fmt); rc = vw_printw(stdscr, fmt, ap); va_end(ap); @@ -754,14 +752,13 @@ void mutt_window_clrtoeol(struct MuttWindow *win) if (!win || !stdscr) return; - int row, col, curcol; - if (win->col_offset + win->cols == COLS) clrtoeol(); else { + int row, col; getyx(stdscr, row, col); - curcol = col; + int curcol = col; while (curcol < win->col_offset + win->cols) { addch(' '); @@ -1336,7 +1333,6 @@ void mutt_format_s_tree(char *buf, size_t buflen, const char *prec, const char * void mutt_paddstr(int n, const char *s) { wchar_t wc; - int w; size_t k; size_t len = mutt_str_strlen(s); mbstate_t mbstate; @@ -1353,7 +1349,7 @@ void mutt_paddstr(int n, const char *s) } if (!IsWPrint(wc)) wc = '?'; - w = wcwidth(wc); + const int w = wcwidth(wc); if (w >= 0) { if (w > n)