public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Remove some NULL checks from the TUI
Date: Sun, 16 Jun 2019 15:25:00 -0000	[thread overview]
Message-ID: <20190616152513.14977.qmail@sourceware.org> (raw)

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

commit 730ead81dfffc181f79a4b79ba8abf6850e63596
Author: Tom Tromey <tom@tromey.com>
Date:   Sat Jun 15 16:06:27 2019 -0600

    Remove some NULL checks from the TUI
    
    I found a few spots in the TUI that were NULL-checking the result of
    XNEW.  This cannot return NULL, so this patch removes the checks.
    
    gdb/ChangeLog
    2019-06-16  Tom Tromey  <tom@tromey.com>
    
    	* tui/tui-data.c (tui_alloc_generic_win_info)
    	(tui_alloc_win_info, tui_add_content_elements): Remove NULL
    	checks.

Diff:
---
 gdb/ChangeLog      |  6 ++++++
 gdb/tui/tui-data.c | 22 ++++++----------------
 2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index af91a3c..6e58fc8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2019-06-16  Tom Tromey  <tom@tromey.com>
+
+	* tui/tui-data.c (tui_alloc_generic_win_info)
+	(tui_alloc_win_info, tui_add_content_elements): Remove NULL
+	checks.
+
 2019-06-16  Bernhard Heckel  <bernhard.heckel@intel.com>
 	    Andrew Burgess  <andrew.burgess@embecosm.com>
 
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index d5f7c73..7c14305 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -424,8 +424,7 @@ tui_alloc_generic_win_info (void)
 {
   struct tui_gen_win_info *win = XNEW (struct tui_gen_win_info);
 
-  if (win != NULL)
-    tui_init_generic_part (win);
+  tui_init_generic_part (win);
 
   return win;
 }
@@ -537,11 +536,8 @@ tui_alloc_win_info (enum tui_win_type type)
 {
   struct tui_win_info *win_info = XNEW (struct tui_win_info);
 
-  if (win_info != NULL)
-    {
-      win_info->generic.type = type;
-      init_win_info (win_info);
-    }
+  win_info->generic.type = type;
+  init_win_info (win_info);
 
   return win_info;
 }
@@ -602,15 +598,9 @@ tui_add_content_elements (struct tui_gen_win_info *win_info,
       for (i = index_start; (i < num_elements + index_start); i++)
 	{
 	  element_ptr = XNEW (struct tui_win_element);
-	  if (element_ptr != NULL)
-	    {
-	      win_info->content[i] = element_ptr;
-	      init_content_element (element_ptr, win_info->type);
-	      win_info->content_size++;
-	    }
-	  else	/* Things must be really hosed now!  We ran out of
-		   memory!?  */
-	    return (-1);
+	  win_info->content[i] = element_ptr;
+	  init_content_element (element_ptr, win_info->type);
+	  win_info->content_size++;
 	}
     }


                 reply	other threads:[~2019-06-16 15:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190616152513.14977.qmail@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).