public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Remove NULL checks from box_win
@ 2019-08-30 19:08 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-08-30 19:08 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=108e13abdf90acc44b1aba4a0f3ee1d49a0f7934

commit 108e13abdf90acc44b1aba4a0f3ee1d49a0f7934
Author: Tom Tromey <tom@tromey.com>
Date:   Mon Jul 15 15:59:53 2019 -0600

    Remove NULL checks from box_win
    
    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-30  Tom Tromey  <tom@tromey.com>
    
    	* tui/tui-wingeneral.c (box_win): Assume win_info and
    	win_info->handle cannot be NULL.

Diff:
---
 gdb/ChangeLog            |  5 +++++
 gdb/tui/tui-wingeneral.c | 35 ++++++++++++++++-------------------
 2 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 388f5eb..9c8299b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2019-08-30  Tom Tromey  <tom@tromey.com>
 
+	* tui/tui-wingeneral.c (box_win): Assume win_info and
+	win_info->handle cannot be NULL.
+
+2019-08-30  Tom Tromey  <tom@tromey.com>
+
 	* tui/tui-regs.h (struct tui_data_item_window) <rerender,
 	refresh_window>: Declare.
 	* tui/tui-regs.c (tui_data_window::display_registers_from): Call
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index ab0363f..01f288b 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);
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-30 19:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-30 19:08 [binutils-gdb] Remove NULL checks from box_win Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).