From 4d3828f6ec46a092fe08ad128561595cd6dcd571 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 16 Nov 2019 10:03:57 -0800 Subject: [PATCH] curses lint 'orient' is the name of an enum defined in wincurs.h so don't use it as a variable name in cursstat.c. My compiler didn't complain using '-Wshadow' but apparently some other one does. Make the same change in the dead code located in the second half of that file, plus a couple of formatting tweaks. --- win/curses/cursstat.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/win/curses/cursstat.c b/win/curses/cursstat.c index 69f0f758c..a2b83d861 100644 --- a/win/curses/cursstat.c +++ b/win/curses/cursstat.c @@ -209,8 +209,8 @@ static void draw_status() { WINDOW *win = curses_get_nhwin(STATUS_WIN); - int orient = curses_get_window_orientation(STATUS_WIN); - boolean horiz = (orient != ALIGN_RIGHT && orient != ALIGN_LEFT); + orient statorient = (orient) curses_get_window_orientation(STATUS_WIN); + boolean horiz = (statorient != ALIGN_RIGHT && statorient != ALIGN_LEFT); boolean border = curses_window_has_border(STATUS_WIN); /* Figure out if we have proper window dimensions for horizontal @@ -1722,18 +1722,14 @@ void curses_update_stats(void) { WINDOW *win = curses_get_nhwin(STATUS_WIN); + orient statorient = (orient) curses_get_window_orientation(STATUS_WIN); + boolean horiz = (statorient != ALIGN_RIGHT && statorient != ALIGN_LEFT); + boolean border = curses_window_has_border(STATUS_WIN); /* Clear the window */ werase(win); - int orient = curses_get_window_orientation(STATUS_WIN); - - boolean horiz = FALSE; - if ((orient != ALIGN_RIGHT) && (orient != ALIGN_LEFT)) - horiz = TRUE; - boolean border = curses_window_has_border(STATUS_WIN); - - /* Figure out if we have proper window dimensions for horizontal statusbar. */ + /* Figure out if we have proper window dimensions for horizontal status */ if (horiz) { /* correct y */ int cy = 3; @@ -1752,7 +1748,8 @@ curses_update_stats(void) curses_last_messages(); doredraw(); - /* Reset XP highlight (since classic_status and new show different numbers) */ + /* Reset XP highlight (since classic_status and new show + different numbers) */ prevexp.highlight_turns = 0; curses_update_stats(); return; @@ -1778,7 +1775,7 @@ curses_update_stats(void) hpmax = u.mhmax; } - if (orient != ALIGN_RIGHT && orient != ALIGN_LEFT) + if (horiz) draw_horizontal(x, y, hp, hpmax); else draw_vertical(x, y, hp, hpmax); @@ -1791,7 +1788,8 @@ curses_update_stats(void) if (first) { first = FALSE; - /* Zero highlight timers. This will call curses_update_status again if needed */ + /* Zero highlight timers. This will call curses_update_status again + if needed */ curses_decrement_highlights(TRUE); } }