From d04b44a16cdfde95de487bcedd541c6e71d82676 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 16 Jun 2019 13:48:21 -0600 Subject: [PATCH] Remove more unnecessary casts of NULL I found a few more spots that unnecessarily cast NULL to a pointer type. My earlier search included a "*" in the cast, but these use a typedef to a pointer type instead. This patch removes these casts. gdb/ChangeLog 2019-06-16 Tom Tromey * tui/tui-data.c (tui_clear_win_detail, init_win_info) (tui_free_window, free_content, free_content_elements): Remove unnecessary cast. * tui/tui-windata.c (tui_display_all_data): Remove unnecessary cast. * tui/tui-regs.c (tui_show_register_group) (tui_display_registers_from, tui_display_reg_element_at_line): Remove unnecessary cast. --- gdb/ChangeLog | 11 +++++++++++ gdb/tui/tui-data.c | 20 ++++++++------------ gdb/tui/tui-regs.c | 7 +++---- gdb/tui/tui-windata.c | 5 ++--- 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cf7a1aba4e9..f16d8478418 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2019-06-16 Tom Tromey + + * tui/tui-data.c (tui_clear_win_detail, init_win_info) + (tui_free_window, free_content, free_content_elements): Remove + unnecessary cast. + * tui/tui-windata.c (tui_display_all_data): Remove unnecessary + cast. + * tui/tui-regs.c (tui_show_register_group) + (tui_display_registers_from, tui_display_reg_element_at_line): + Remove unnecessary cast. + 2019-06-16 Andrew Burgess * linux-nat.c (normal_mask): Delete. diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index 35eae4f998a..2df9cbcd07b 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -198,11 +198,9 @@ tui_clear_win_detail (struct tui_win_info *win_info) wmove (win_info->generic.handle, 0, 0); break; case DATA_WIN: - win_info->detail.data_display_info.data_content = - (tui_win_content) NULL; + win_info->detail.data_display_info.data_content = NULL; win_info->detail.data_display_info.data_content_count = 0; - win_info->detail.data_display_info.regs_content = - (tui_win_content) NULL; + win_info->detail.data_display_info.regs_content = NULL; win_info->detail.data_display_info.regs_content_count = 0; win_info->detail.data_display_info.regs_column_count = 1; win_info->detail.data_display_info.display_regs = FALSE; @@ -516,9 +514,9 @@ init_win_info (struct tui_win_info *win_info) win_info->detail.source_info.fullname = NULL; break; case DATA_WIN: - win_info->detail.data_display_info.data_content = (tui_win_content) NULL; + win_info->detail.data_display_info.data_content = NULL; win_info->detail.data_display_info.data_content_count = 0; - win_info->detail.data_display_info.regs_content = (tui_win_content) NULL; + win_info->detail.data_display_info.regs_content = NULL; win_info->detail.data_display_info.regs_content_count = 0; win_info->detail.data_display_info.regs_column_count = 1; win_info->detail.data_display_info.display_regs = FALSE; @@ -686,13 +684,11 @@ tui_free_window (struct tui_win_info *win_info) { tui_free_data_content (win_info->detail.data_display_info.regs_content, win_info->detail.data_display_info.regs_content_count); - win_info->detail.data_display_info.regs_content = - (tui_win_content) NULL; + win_info->detail.data_display_info.regs_content = NULL; win_info->detail.data_display_info.regs_content_count = 0; tui_free_data_content (win_info->detail.data_display_info.data_content, win_info->detail.data_display_info.data_content_count); - win_info->detail.data_display_info.data_content = - (tui_win_content) NULL; + win_info->detail.data_display_info.data_content = NULL; win_info->detail.data_display_info.data_content_count = 0; win_info->detail.data_display_info.regs_column_count = 1; win_info->detail.data_display_info.display_regs = FALSE; @@ -808,7 +804,7 @@ free_content (tui_win_content content, int content_size, enum tui_win_type win_type) { - if (content != (tui_win_content) NULL) + if (content != NULL) { free_content_elements (content, content_size, win_type); xfree (content); @@ -823,7 +819,7 @@ free_content_elements (tui_win_content content, int content_size, enum tui_win_type type) { - if (content != (tui_win_content) NULL) + if (content != NULL) { int i; diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index dcfc433407c..b3456113369 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -237,7 +237,7 @@ tui_show_register_group (struct reggroup *group, refresh_values_only = FALSE; } - if (display_info->regs_content != (tui_win_content) NULL) + if (display_info->regs_content != NULL) { if (!refresh_values_only || allocated_here) { @@ -299,7 +299,7 @@ tui_display_registers_from (int start_element_no) { struct tui_data_info *display_info = &TUI_DATA_WIN->detail.data_display_info; - if (display_info->regs_content != (tui_win_content) NULL + if (display_info->regs_content != NULL && display_info->regs_content_count > 0) { int i = start_element_no; @@ -398,8 +398,7 @@ static void tui_display_reg_element_at_line (int start_element_no, int start_line_no) { - if (TUI_DATA_WIN->detail.data_display_info.regs_content - != (tui_win_content) NULL + if (TUI_DATA_WIN->detail.data_display_info.regs_content != NULL && TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0) { int element_no = start_element_no; diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c index 6f150c96620..8616b6c47b9 100644 --- a/gdb/tui/tui-windata.c +++ b/gdb/tui/tui-windata.c @@ -55,7 +55,7 @@ tui_first_data_item_displayed (void) data_item_win = &TUI_DATA_WIN->generic.content[i]->which_element.data_window; - if (data_item_win->handle != NULL + if (data_item_win->handle != NULL && data_item_win->is_visible) element_no = i; } @@ -138,8 +138,7 @@ tui_display_all_data (void) tui_display_registers_from (0); /* Then display the other data. */ - if (TUI_DATA_WIN->detail.data_display_info.data_content != - (tui_win_content) NULL + if (TUI_DATA_WIN->detail.data_display_info.data_content != NULL && TUI_DATA_WIN->detail.data_display_info.data_content_count > 0) { } -- 2.30.2