aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2015-08-31 21:32:11 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2015-09-04 16:50:41 +0100
commite65b52456bc3f60a176fece5e34e420c5a75bd16 (patch)
treea80435ebf6243e0db672f69c2c8db5c761f7eb6f /gdb
parentb03e6ad9cd2064214c0fbff179c7e47c855315e3 (diff)
downloadgdb-e65b52456bc3f60a176fece5e34e420c5a75bd16.zip
gdb-e65b52456bc3f60a176fece5e34e420c5a75bd16.tar.gz
gdb-e65b52456bc3f60a176fece5e34e420c5a75bd16.tar.bz2
gdb/tui: Remove casts of NULL during assignment.
In the following code: struct symbol *wsym = (struct symbol *) NULL; the cast of NULL is redundant, it adds noise, and is just one more thing to change if the type of wsym ever changes. There are a relatively small number of places in gdb where the above code pattern is used. Usually the cast is removed like this: struct symbol *wsym = NULL; This commit updates all the places within the gdb/tui directory where we cast NULL during assignment, removing the cast. gdb/ChangeLog: * tui/tui-data.c (win_with_focus): Remove cast of NULL pointer. (tui_next_win): Likewise. (tui_prev_win): Likewise. (tui_partial_win_by_name): Likewise. (tui_init_generic_part): Likewise. (init_content_element): Likewise. (tui_del_window): Likewise. (tui_free_window): Likewise. (tui_del_data_windows): Likewise. (tui_free_data_content): Likewise. * tui/tui-layout.c (make_source_or_disasm_window): Likewise. * tui/tui-regs.c (tui_show_register_group): Likewise. * tui/tui-win.c (tui_resize_all): Likewise. (tui_set_focus): Likewise. (tui_set_win_height): Likewise. (make_invisible_and_set_new_height): Likewise. * tui/tui-windata.c (tui_delete_data_content_windows): Likewise. * tui/tui-wingeneral.c (make_visible): Likewise.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog21
-rw-r--r--gdb/tui/tui-data.c32
-rw-r--r--gdb/tui/tui-layout.c2
-rw-r--r--gdb/tui/tui-regs.c2
-rw-r--r--gdb/tui/tui-win.c8
-rw-r--r--gdb/tui/tui-windata.c2
-rw-r--r--gdb/tui/tui-wingeneral.c2
7 files changed, 45 insertions, 24 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fdf2cd1..370980d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,26 @@
2015-09-04 Andrew Burgess <andrew.burgess@embecosm.com>
+ * tui/tui-data.c (win_with_focus): Remove cast of NULL pointer.
+ (tui_next_win): Likewise.
+ (tui_prev_win): Likewise.
+ (tui_partial_win_by_name): Likewise.
+ (tui_init_generic_part): Likewise.
+ (init_content_element): Likewise.
+ (tui_del_window): Likewise.
+ (tui_free_window): Likewise.
+ (tui_del_data_windows): Likewise.
+ (tui_free_data_content): Likewise.
+ * tui/tui-layout.c (make_source_or_disasm_window): Likewise.
+ * tui/tui-regs.c (tui_show_register_group): Likewise.
+ * tui/tui-win.c (tui_resize_all): Likewise.
+ (tui_set_focus): Likewise.
+ (tui_set_win_height): Likewise.
+ (make_invisible_and_set_new_height): Likewise.
+ * tui/tui-windata.c (tui_delete_data_content_windows): Likewise.
+ * tui/tui-wingeneral.c (make_visible): Likewise.
+
+2015-09-04 Andrew Burgess <andrew.burgess@embecosm.com>
+
* cli/cli-decode.c (find_cmd): Remove cast of NULL pointer.
2015-09-04 Andrew Burgess <andrew.burgess@embecosm.com>
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index b584251..2fcd547 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -41,7 +41,7 @@ static struct tui_gen_win_info exec_info[2];
static struct tui_win_info *src_win_list[2];
static struct tui_list source_windows = {src_win_list, 0};
static int default_tab_len = DEFAULT_TAB_LEN;
-static struct tui_win_info *win_with_focus = (struct tui_win_info *) NULL;
+static struct tui_win_info *win_with_focus = NULL;
static struct tui_layout_def layout_def = {
SRC_WIN, /* DISPLAY_MODE */
FALSE}; /* SPLIT */
@@ -315,7 +315,7 @@ struct tui_win_info *
tui_next_win (struct tui_win_info *cur_win)
{
int type = cur_win->generic.type;
- struct tui_win_info *next_win = (struct tui_win_info *) NULL;
+ struct tui_win_info *next_win = NULL;
if (cur_win->generic.type == CMD_WIN)
type = SRC_WIN;
@@ -345,7 +345,7 @@ struct tui_win_info *
tui_prev_win (struct tui_win_info *cur_win)
{
int type = cur_win->generic.type;
- struct tui_win_info *prev = (struct tui_win_info *) NULL;
+ struct tui_win_info *prev = NULL;
if (cur_win->generic.type == SRC_WIN)
type = CMD_WIN;
@@ -373,7 +373,7 @@ tui_prev_win (struct tui_win_info *cur_win)
struct tui_win_info *
tui_partial_win_by_name (char *name)
{
- struct tui_win_info *win_info = (struct tui_win_info *) NULL;
+ struct tui_win_info *win_info = NULL;
if (name != (char *) NULL)
{
@@ -458,7 +458,7 @@ tui_init_generic_part (struct tui_gen_win_info *win)
win->viewport_height =
win->content_size =
win->last_visible_line = 0;
- win->handle = (WINDOW *) NULL;
+ win->handle = NULL;
win->content = NULL;
win->content_in_use =
win->is_visible = FALSE;
@@ -477,7 +477,7 @@ init_content_element (struct tui_win_element *element,
{
case SRC_WIN:
case DISASSEM_WIN:
- element->which_element.source.line = (char *) NULL;
+ element->which_element.source.line = NULL;
element->which_element.source.line_or_addr.loa = LOA_LINE;
element->which_element.source.line_or_addr.u.line_no = 0;
element->which_element.source.is_exec_point = FALSE;
@@ -491,15 +491,15 @@ init_content_element (struct tui_win_element *element,
element->which_element.data_window.content_size = 1;
break;
case CMD_WIN:
- element->which_element.command.line = (char *) NULL;
+ element->which_element.command.line = NULL;
break;
case DATA_ITEM_WIN:
- element->which_element.data.name = (char *) NULL;
+ element->which_element.data.name = NULL;
element->which_element.data.type = TUI_REGISTER;
element->which_element.data.item_no = UNDEFINED_ITEM;
element->which_element.data.value = NULL;
element->which_element.data.highlight = FALSE;
- element->which_element.data.content = (char*) NULL;
+ element->which_element.data.content = NULL;
break;
case LOCATOR_WIN:
element->which_element.locator.full_name[0] =
@@ -665,7 +665,7 @@ tui_del_window (struct tui_win_info *win_info)
if (generic_win != (struct tui_gen_win_info *) NULL)
{
tui_delete_win (generic_win->handle);
- generic_win->handle = (WINDOW *) NULL;
+ generic_win->handle = NULL;
generic_win->is_visible = FALSE;
}
if (win_info->detail.source_info.fullname)
@@ -677,7 +677,7 @@ tui_del_window (struct tui_win_info *win_info)
if (generic_win != (struct tui_gen_win_info *) NULL)
{
tui_delete_win (generic_win->handle);
- generic_win->handle = (WINDOW *) NULL;
+ generic_win->handle = NULL;
generic_win->is_visible = FALSE;
}
break;
@@ -696,7 +696,7 @@ tui_del_window (struct tui_win_info *win_info)
if (win_info->generic.handle != (WINDOW *) NULL)
{
tui_delete_win (win_info->generic.handle);
- win_info->generic.handle = (WINDOW *) NULL;
+ win_info->generic.handle = NULL;
win_info->generic.is_visible = FALSE;
}
}
@@ -720,7 +720,7 @@ tui_free_window (struct tui_win_info *win_info)
if (generic_win != (struct tui_gen_win_info *) NULL)
{
tui_delete_win (generic_win->handle);
- generic_win->handle = (WINDOW *) NULL;
+ generic_win->handle = NULL;
tui_free_win_content (generic_win);
}
break;
@@ -749,7 +749,7 @@ tui_free_window (struct tui_win_info *win_info)
if (win_info->generic.handle != (WINDOW *) NULL)
{
tui_delete_win (win_info->generic.handle);
- win_info->generic.handle = (WINDOW *) NULL;
+ win_info->generic.handle = NULL;
tui_free_win_content (&win_info->generic);
}
if (win_info->generic.title)
@@ -807,7 +807,7 @@ tui_del_data_windows (tui_win_content content,
if (generic_win != (struct tui_gen_win_info *) NULL)
{
tui_delete_win (generic_win->handle);
- generic_win->handle = (WINDOW *) NULL;
+ generic_win->handle = NULL;
generic_win->is_visible = FALSE;
}
}
@@ -831,7 +831,7 @@ tui_free_data_content (tui_win_content content,
if (generic_win != (struct tui_gen_win_info *) NULL)
{
tui_delete_win (generic_win->handle);
- generic_win->handle = (WINDOW *) NULL;
+ generic_win->handle = NULL;
tui_free_win_content (generic_win);
}
}
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 0255c39..2528296 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -863,7 +863,7 @@ make_source_or_disasm_window (struct tui_win_info **win_info_ptr,
enum tui_win_type type,
int height, int origin_y)
{
- struct tui_gen_win_info *execution_info = (struct tui_gen_win_info *) NULL;
+ struct tui_gen_win_info *execution_info = NULL;
/* Create the exeuction info window. */
if (type == SRC_WIN)
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index a61fadb..fde1707 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -244,7 +244,7 @@ tui_show_register_group (struct reggroup *group,
{
if (!refresh_values_only || allocated_here)
{
- TUI_DATA_WIN->generic.content = (void*) NULL;
+ TUI_DATA_WIN->generic.content = NULL;
TUI_DATA_WIN->generic.content_size = 0;
tui_add_content_elements (&TUI_DATA_WIN->generic, nr_regs);
display_info->regs_content
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 6768d35..d841a61 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -900,7 +900,7 @@ tui_resize_all (void)
&& !tui_win_list[win_type]->generic.is_visible)
{
tui_free_window (tui_win_list[win_type]);
- tui_win_list[win_type] = (struct tui_win_info *) NULL;
+ tui_win_list[win_type] = NULL;
}
}
/* Turn keypad back on, unless focus is in the command
@@ -1048,7 +1048,7 @@ tui_set_focus (char *arg, int from_tty)
{
char *buf_ptr = (char *) xstrdup (arg);
int i;
- struct tui_win_info *win_info = (struct tui_win_info *) NULL;
+ struct tui_win_info *win_info = NULL;
for (i = 0; (i < strlen (buf_ptr)); i++)
buf_ptr[i] = tolower (arg[i]);
@@ -1170,7 +1170,7 @@ tui_set_win_height (char *arg, int from_tty)
{
char *buf = xstrdup (arg);
char *buf_ptr = buf;
- char *wname = (char *) NULL;
+ char *wname = NULL;
int new_height, i;
struct tui_win_info *win_info;
struct cleanup *old_chain;
@@ -1457,7 +1457,7 @@ make_invisible_and_set_new_height (struct tui_win_info *win_info,
&((struct tui_win_element *)
win_info->generic.content[i])->which_element.data_window;
tui_delete_win (gen_win_info->handle);
- gen_win_info->handle = (WINDOW *) NULL;
+ gen_win_info->handle = NULL;
}
break;
default:
diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c
index 5271ee8..08be4d5 100644
--- a/gdb/tui/tui-windata.c
+++ b/gdb/tui/tui-windata.c
@@ -94,7 +94,7 @@ tui_delete_data_content_windows (void)
data_item_win_ptr = &((tui_win_content)
TUI_DATA_WIN->generic.content)[i]->which_element.data_window;
tui_delete_win (data_item_win_ptr->handle);
- data_item_win_ptr->handle = (WINDOW *) NULL;
+ data_item_win_ptr->handle = NULL;
data_item_win_ptr->is_visible = FALSE;
}
}
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index b95da49..b6d3d0f 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -194,7 +194,7 @@ make_visible (struct tui_gen_win_info *win_info, int visible)
{
win_info->is_visible = FALSE;
tui_delete_win (win_info->handle);
- win_info->handle = (WINDOW *) NULL;
+ win_info->handle = NULL;
}
return;