From: Tom Tromey Date: Sat, 15 Jun 2019 22:06:27 +0000 (-0600) Subject: Remove some NULL checks from the TUI X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=730ead81dfffc181f79a4b79ba8abf6850e63596;p=binutils-gdb.git 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 * tui/tui-data.c (tui_alloc_generic_win_info) (tui_alloc_win_info, tui_add_content_elements): Remove NULL checks. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index af91a3cc07c..6e58fc879c2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2019-06-16 Tom Tromey + + * 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 Andrew Burgess diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index d5f7c733353..7c143055337 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++; } }