[07/15] Remove NULL checks from box_win

Message ID 20190821022535.9762-8-tom@tromey.com
State New
Headers show
Series
  • More TUI Refactorings
Related show

Commit Message

Tom Tromey Aug. 21, 2019, 2:25 a.m.
box_win can't be called with a NULL window, or with an invisible
window.  So, the NULL checks in that function can be removed.

gdb/ChangeLog
2019-08-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.c (box_win): Assume win_info and
	win_info->handle cannot be NULL.
---
 gdb/ChangeLog            |  5 +++++
 gdb/tui/tui-wingeneral.c | 35 ++++++++++++++++-------------------
 2 files changed, 21 insertions(+), 19 deletions(-)

-- 
2.17.2

Patch

diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index ab0363f856c..01f288be862 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -58,30 +58,27 @@  static void
 box_win (struct tui_win_info *win_info, 
 	 bool highlight_flag)
 {
-  if (win_info && win_info->handle)
-    {
-      WINDOW *win;
-      int attrs;
+  WINDOW *win;
+  int attrs;
 
-      win = win_info->handle;
-      if (highlight_flag)
-        attrs = tui_active_border_attrs;
-      else
-        attrs = tui_border_attrs;
+  win = win_info->handle;
+  if (highlight_flag)
+    attrs = tui_active_border_attrs;
+  else
+    attrs = tui_border_attrs;
 
-      wattron (win, attrs);
+  wattron (win, attrs);
 #ifdef HAVE_WBORDER
-      wborder (win, tui_border_vline, tui_border_vline,
-               tui_border_hline, tui_border_hline,
-               tui_border_ulcorner, tui_border_urcorner,
-               tui_border_llcorner, tui_border_lrcorner);
+  wborder (win, tui_border_vline, tui_border_vline,
+	   tui_border_hline, tui_border_hline,
+	   tui_border_ulcorner, tui_border_urcorner,
+	   tui_border_llcorner, tui_border_lrcorner);
 #else
-      box (win, tui_border_vline, tui_border_hline);
+  box (win, tui_border_vline, tui_border_hline);
 #endif
-      if (!win_info->title.empty ())
-        mvwaddstr (win, 0, 3, win_info->title.c_str ());
-      wattroff (win, attrs);
-    }
+  if (!win_info->title.empty ())
+    mvwaddstr (win, 0, 3, win_info->title.c_str ());
+  wattroff (win, attrs);
 }