aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-06-16 09:56:35 -0600
committerTom Tromey <tom@tromey.com>2019-06-16 09:59:03 -0600
commitcafb34387d063fa47bc2cdb33fc3fe2f13e6cec0 (patch)
tree99c29b479d49a6b930509b712b0d960feef00587 /gdb/tui
parent93cb9841d68263174a600dc70af742a8e2eabfc6 (diff)
downloadgdb-cafb34387d063fa47bc2cdb33fc3fe2f13e6cec0.zip
gdb-cafb34387d063fa47bc2cdb33fc3fe2f13e6cec0.tar.gz
gdb-cafb34387d063fa47bc2cdb33fc3fe2f13e6cec0.tar.bz2
Remove unnecessary casts of NULL
I noticed some unnecessary casts of NULL. This removes all the unnecessary ones, leaving only ones where we must ensure that NULL has pointer type for passing through varargs. I removed a couple of useless casts of 0 that I noticed while writing this. Tested by rebuilding. gdb/ChangeLog 2019-06-16 Tom Tromey <tom@tromey.com> * valops.c (value_cast, value_slice): Remove unnecessary cast. * breakpoint.c (stopin_command, stopat_command) (until_break_command, decode_location_default): Remove unnecessary cast. * utils.c (subset_compare): Remove unnecessary cast. * ada-lang.c (ada_update_initial_language): Remove unnecessary cast. * linespec.c (decode_line_with_last_displayed): Remove unnecessary cast. * infcmd.c (path_command): Remove unnecessary cast. * coffread.c (decode_type): Remove unnecessary cast. * xcoffread.c (read_xcoff_symtab): Remove unnecessary cast. * mipsread.c (mipscoff_symfile_read): Remove unnecessary cast. * tui/tui-stack.c (tui_show_locator_content) (tui_show_frame_info): Remove unnecessary cast. * tui/tui-win.c (tui_scroll_forward_command) (tui_scroll_backward_command, tui_set_focus, tui_set_win_height) (parse_scrolling_args): Remove unnecessary cast. * tui/tui-data.c (init_win_info, tui_del_window) (tui_free_window, tui_del_data_windows, tui_free_data_content) (free_content_elements): Remove unnecessary cast. * tui/tui-windata.c (tui_first_data_item_displayed): Remove unnecessary cast. * tui/tui-source.c (tui_set_source_content) (tui_vertical_source_scroll): Remove unnecessary cast. * tui/tui-layout.c (tui_default_win_height): Remove unnecessary cast. * tui/tui-io.c (tui_initialize_io): Remove unnecessary cast. * tui/tui-regs.c (tui_display_registers_from) (tui_display_register): Remove unnecessary cast. * tui/tui-wingeneral.c (tui_refresh_win, tui_delete_win) (tui_unhighlight_win, tui_highlight_win, tui_make_window) (make_visible): Remove unnecessary cast. * tui/tui-winsource.c (tui_erase_source_content) (tui_update_breakpoint_info, tui_set_exec_info_content): Remove unnecessary cast. * ax-gdb.c (agent_command_1): Remove unnecessary cast. * cli/cli-setshow.c (cmd_show_list): Remove unnecessary cast. * stabsread.c (read_type, read_array_type, read_range_type): Remove unnecessary cast. * mdebugread.c (mdebug_build_psymtabs): Remove unnecessary cast. (parse_symbol, parse_type, upgrade_type, parse_external) (parse_partial_symbols, psymtab_to_symtab_1, cross_ref): Remove unnecessary cast. * gdb_bfd.c (gdb_bfd_map_section): Remove unnecessary cast.
Diffstat (limited to 'gdb/tui')
-rw-r--r--gdb/tui/tui-data.c19
-rw-r--r--gdb/tui/tui-io.c2
-rw-r--r--gdb/tui/tui-layout.c2
-rw-r--r--gdb/tui/tui-regs.c6
-rw-r--r--gdb/tui/tui-source.c4
-rw-r--r--gdb/tui/tui-stack.c5
-rw-r--r--gdb/tui/tui-win.c12
-rw-r--r--gdb/tui/tui-windata.c2
-rw-r--r--gdb/tui/tui-wingeneral.c14
-rw-r--r--gdb/tui/tui-winsource.c7
10 files changed, 34 insertions, 39 deletions
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index 7c14305..35eae4f 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -507,8 +507,7 @@ init_win_info (struct tui_win_info *win_info)
{
case SRC_WIN:
case DISASSEM_WIN:
- win_info->detail.source_info.execution_info
- = (struct tui_gen_win_info *) NULL;
+ win_info->detail.source_info.execution_info = NULL;
win_info->detail.source_info.has_locator = FALSE;
win_info->detail.source_info.horizontal_offset = 0;
win_info->detail.source_info.gdbarch = NULL;
@@ -620,7 +619,7 @@ tui_del_window (struct tui_win_info *win_info)
case SRC_WIN:
case DISASSEM_WIN:
generic_win = tui_locator_win_info_ptr ();
- if (generic_win != (struct tui_gen_win_info *) NULL)
+ if (generic_win != NULL)
{
tui_delete_win (generic_win->handle);
generic_win->handle = NULL;
@@ -632,7 +631,7 @@ tui_del_window (struct tui_win_info *win_info)
win_info->detail.source_info.fullname = NULL;
}
generic_win = win_info->detail.source_info.execution_info;
- if (generic_win != (struct tui_gen_win_info *) NULL)
+ if (generic_win != NULL)
{
tui_delete_win (generic_win->handle);
generic_win->handle = NULL;
@@ -651,7 +650,7 @@ tui_del_window (struct tui_win_info *win_info)
default:
break;
}
- if (win_info->generic.handle != (WINDOW *) NULL)
+ if (win_info->generic.handle != NULL)
{
tui_delete_win (win_info->generic.handle);
win_info->generic.handle = NULL;
@@ -675,7 +674,7 @@ tui_free_window (struct tui_win_info *win_info)
win_info->detail.source_info.fullname = NULL;
}
generic_win = win_info->detail.source_info.execution_info;
- if (generic_win != (struct tui_gen_win_info *) NULL)
+ if (generic_win != NULL)
{
tui_delete_win (generic_win->handle);
generic_win->handle = NULL;
@@ -704,7 +703,7 @@ tui_free_window (struct tui_win_info *win_info)
default:
break;
}
- if (win_info->generic.handle != (WINDOW *) NULL)
+ if (win_info->generic.handle != NULL)
{
tui_delete_win (win_info->generic.handle);
win_info->generic.handle = NULL;
@@ -762,7 +761,7 @@ tui_del_data_windows (tui_win_content content,
struct tui_gen_win_info *generic_win
= &content[i]->which_element.data_window;
- if (generic_win != (struct tui_gen_win_info *) NULL)
+ if (generic_win != NULL)
{
tui_delete_win (generic_win->handle);
generic_win->handle = NULL;
@@ -786,7 +785,7 @@ tui_free_data_content (tui_win_content content,
struct tui_gen_win_info *generic_win
= &content[i]->which_element.data_window;
- if (generic_win != (struct tui_gen_win_info *) NULL)
+ if (generic_win != NULL)
{
tui_delete_win (generic_win->handle);
generic_win->handle = NULL;
@@ -840,7 +839,7 @@ free_content_elements (tui_win_content content,
struct tui_win_element *element;
element = content[i];
- if (element != (struct tui_win_element *) NULL)
+ if (element != NULL)
{
switch (type)
{
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index ad47c82..31c1c76 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -878,7 +878,7 @@ tui_initialize_io (void)
if (tui_rl_outstream == 0)
error (_("Cannot redirect readline output"));
- setvbuf (tui_rl_outstream, (char*) NULL, _IOLBF, 0);
+ setvbuf (tui_rl_outstream, NULL, _IOLBF, 0);
#ifdef O_NONBLOCK
(void) fcntl (tui_readline_pipe[0], F_SETFL, O_NONBLOCK);
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index da50ced..bcae819 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -300,7 +300,7 @@ tui_default_win_height (enum tui_win_type type,
{
int h;
- if (tui_win_list[type] != (struct tui_win_info *) NULL)
+ if (tui_win_list[type] != NULL)
h = tui_win_list[type]->generic.height;
else
{
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index e6aeedd..dcfc433 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -358,7 +358,7 @@ tui_display_registers_from (int start_element_no)
data_item_win = &display_info->regs_content[i]
->which_element.data_window;
data_element_ptr = &data_item_win->content[0]->which_element.data;
- if (data_item_win->handle != (WINDOW*) NULL
+ if (data_item_win->handle != NULL
&& (data_item_win->height != 1
|| data_item_win->width != item_win_width
|| data_item_win->origin.x != (item_win_width * j) + 1
@@ -368,7 +368,7 @@ tui_display_registers_from (int start_element_no)
data_item_win->handle = 0;
}
- if (data_item_win->handle == (WINDOW *) NULL)
+ if (data_item_win->handle == NULL)
{
data_item_win->height = 1;
data_item_win->width = item_win_width;
@@ -520,7 +520,7 @@ static void
tui_display_register (struct tui_data_element *data,
struct tui_gen_win_info *win_info)
{
- if (win_info->handle != (WINDOW *) NULL)
+ if (win_info->handle != NULL)
{
int i;
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 1fa0e98..5066c7d 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -129,7 +129,7 @@ tui_set_source_content (struct symtab *s,
{
enum tui_status ret = TUI_FAILURE;
- if (s != (struct symtab *) NULL)
+ if (s != NULL)
{
int line_width, nlines;
@@ -319,7 +319,7 @@ tui_vertical_source_scroll (enum tui_scroll_direction scroll_direction,
tui_win_content content = TUI_SRC_WIN->generic.content;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
- if (cursal.symtab == (struct symtab *) NULL)
+ if (cursal.symtab == NULL)
s = find_pc_line_symtab (get_frame_pc (get_selected_frame (NULL)));
else
s = cursal.symtab;
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index 79f1f6f..b7e7ae8 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -250,7 +250,7 @@ tui_show_locator_content (void)
locator = tui_locator_win_info_ptr ();
- if (locator != NULL && locator->handle != (WINDOW *) NULL)
+ if (locator != NULL && locator->handle != NULL)
{
struct tui_win_element *element;
@@ -414,8 +414,7 @@ tui_show_frame_info (struct frame_info *fi)
else
{
if (find_pc_partial_function (get_frame_pc (fi),
- (const char **) NULL,
- &low, NULL) == 0)
+ NULL, &low, NULL) == 0)
{
/* There is no symbol available for current PC. There is no
safe way how to "disassemble backwards". */
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 575620f..a1329e5 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -877,7 +877,7 @@ tui_scroll_forward_command (const char *arg, int from_tty)
/* Make sure the curses mode is enabled. */
tui_enable ();
if (arg == NULL)
- parse_scrolling_args (arg, &win_to_scroll, (int *) NULL);
+ parse_scrolling_args (arg, &win_to_scroll, NULL);
else
parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
tui_scroll (FORWARD_SCROLL, win_to_scroll, num_to_scroll);
@@ -893,7 +893,7 @@ tui_scroll_backward_command (const char *arg, int from_tty)
/* Make sure the curses mode is enabled. */
tui_enable ();
if (arg == NULL)
- parse_scrolling_args (arg, &win_to_scroll, (int *) NULL);
+ parse_scrolling_args (arg, &win_to_scroll, NULL);
else
parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
tui_scroll (BACKWARD_SCROLL, win_to_scroll, num_to_scroll);
@@ -946,8 +946,7 @@ tui_set_focus (const char *arg, int from_tty)
else
win_info = tui_partial_win_by_name (buf_ptr);
- if (win_info == (struct tui_win_info *) NULL
- || !win_info->generic.is_visible)
+ if (win_info == NULL || !win_info->generic.is_visible)
warning (_("Invalid window specified. \n\
The window name specified must be valid and visible.\n"));
else
@@ -1116,8 +1115,7 @@ tui_set_win_height (const char *arg, int from_tty)
wname[i] = tolower (wname[i]);
win_info = tui_partial_win_by_name (wname);
- if (win_info == (struct tui_win_info *) NULL
- || !win_info->generic.is_visible)
+ if (win_info == NULL || !win_info->generic.is_visible)
warning (_("Invalid window specified. \n\
The window name specified must be valid and visible.\n"));
else
@@ -1634,7 +1632,7 @@ parse_scrolling_args (const char *arg,
*win_to_scroll = tui_partial_win_by_name (wname);
- if (*win_to_scroll == (struct tui_win_info *) NULL
+ if (*win_to_scroll == NULL
|| !(*win_to_scroll)->generic.is_visible)
error (_("Invalid window specified. \n\
The window name specified must be valid and visible.\n"));
diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c
index 1bab39f..6f150c9 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 != (WINDOW *) NULL
+ if (data_item_win->handle != NULL
&& data_item_win->is_visible)
element_no = i;
}
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index b1ed0f4..b474aa0 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -45,7 +45,7 @@ tui_refresh_win (struct tui_gen_win_info *win_info)
data_item_win_ptr = &win_info->content[i]->which_element.data_window;
if (data_item_win_ptr != NULL
- && data_item_win_ptr->handle != (WINDOW *) NULL)
+ && data_item_win_ptr->handle != NULL)
wrefresh (data_item_win_ptr->handle);
}
}
@@ -55,7 +55,7 @@ tui_refresh_win (struct tui_gen_win_info *win_info)
}
else
{
- if (win_info->handle != (WINDOW *) NULL)
+ if (win_info->handle != NULL)
wrefresh (win_info->handle);
}
@@ -67,7 +67,7 @@ tui_refresh_win (struct tui_gen_win_info *win_info)
void
tui_delete_win (WINDOW *window)
{
- if (window != (WINDOW *) NULL)
+ if (window != NULL)
delwin (window);
return;
@@ -110,7 +110,7 @@ void
tui_unhighlight_win (struct tui_win_info *win_info)
{
if (win_info != NULL
- && win_info->generic.handle != (WINDOW *) NULL)
+ && win_info->generic.handle != NULL)
{
box_win ((struct tui_gen_win_info *) win_info, NO_HILITE);
wrefresh (win_info->generic.handle);
@@ -124,7 +124,7 @@ tui_highlight_win (struct tui_win_info *win_info)
{
if (win_info != NULL
&& win_info->can_highlight
- && win_info->generic.handle != (WINDOW *) NULL)
+ && win_info->generic.handle != NULL)
{
box_win ((struct tui_gen_win_info *) win_info, HILITE);
wrefresh (win_info->generic.handle);
@@ -157,7 +157,7 @@ tui_make_window (struct tui_gen_win_info *win_info, int box_it)
win_info->origin.y,
win_info->origin.x);
win_info->handle = handle;
- if (handle != (WINDOW *) NULL)
+ if (handle != NULL)
{
if (box_it == BOX_WINDOW)
box_win (win_info, NO_HILITE);
@@ -189,7 +189,7 @@ make_visible (struct tui_gen_win_info *win_info, int visible)
}
else if (!visible
&& win_info->is_visible
- && win_info->handle != (WINDOW *) NULL)
+ && win_info->handle != NULL)
{
win_info->is_visible = FALSE;
tui_delete_win (win_info->handle);
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index e31a016..eab422d 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -235,7 +235,7 @@ tui_erase_source_content (struct tui_win_info *win_info,
int x_pos;
int half_width = (win_info->generic.width - 2) / 2;
- if (win_info->generic.handle != (WINDOW *) NULL)
+ if (win_info->generic.handle != NULL)
{
werase (win_info->generic.handle);
tui_check_and_display_highlight_if_needed (win_info);
@@ -453,7 +453,7 @@ tui_update_breakpoint_info (struct tui_win_info *win,
those that we already hit. */
mode = 0;
for (bp = breakpoint_chain;
- bp != (struct breakpoint *) NULL;
+ bp != NULL;
bp = bp->next)
{
struct bp_location *loc;
@@ -504,8 +504,7 @@ tui_set_exec_info_content (struct tui_win_info *win_info)
{
enum tui_status ret = TUI_SUCCESS;
- if (win_info->detail.source_info.execution_info
- != (struct tui_gen_win_info *) NULL)
+ if (win_info->detail.source_info.execution_info != NULL)
{
struct tui_gen_win_info *exec_info_ptr
= win_info->detail.source_info.execution_info;