aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-data.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-06-16 15:53:36 -0600
committerTom Tromey <tom@tromey.com>2019-06-25 07:48:36 -0600
commitdc2c33e4562e0af441a9c8acff0400a78cb45d98 (patch)
treedb6725303251823e7fcab4872863763a054a05de /gdb/tui/tui-data.c
parent214a5cbea656f3ffc1e7e525627c56849347c709 (diff)
downloadgdb-dc2c33e4562e0af441a9c8acff0400a78cb45d98.zip
gdb-dc2c33e4562e0af441a9c8acff0400a78cb45d98.tar.gz
gdb-dc2c33e4562e0af441a9c8acff0400a78cb45d98.tar.bz2
Change tui_which_element::data_window to be a pointer
A coming patch will add a constructor to tui_gen_win_info. However, because the tui_which_element union contains an object of this type, first something must be done here in order to avoid having a union with a member that has a constructor. This patch changes this element to be a pointer instead. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_refresh_win): Update. * tui/tui-windata.c (tui_first_data_item_displayed) (tui_delete_data_content_windows): Update. * tui/tui-win.c (tui_data_window::set_new_height): Update. * tui/tui-regs.c (tui_show_registers, tui_show_register_group) (tui_display_registers_from, tui_check_register_values): Update. * tui/tui-data.h (union tui_which_element) <data_window>: Now a pointer. * tui/tui-data.c (init_content_element): Update. Allocate the new window. (tui_free_data_content): Update. (free_content_elements) <case DATA_WIN>: Free the window.
Diffstat (limited to 'gdb/tui/tui-data.c')
-rw-r--r--gdb/tui/tui-data.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index a351113..5a742ac 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -435,11 +435,12 @@ init_content_element (struct tui_win_element *element,
element->which_element.source.has_break = FALSE;
break;
case DATA_WIN:
- tui_init_generic_part (&element->which_element.data_window);
- element->which_element.data_window.type = DATA_ITEM_WIN;
- element->which_element.data_window.content =
+ element->which_element.data_window = XNEW (struct tui_gen_win_info);
+ tui_init_generic_part (element->which_element.data_window);
+ element->which_element.data_window->type = DATA_ITEM_WIN;
+ element->which_element.data_window->content =
tui_alloc_content (1, DATA_ITEM_WIN);
- element->which_element.data_window.content_size = 1;
+ element->which_element.data_window->content_size = 1;
break;
case CMD_WIN:
element->which_element.command.line = NULL;
@@ -646,7 +647,7 @@ tui_free_data_content (tui_win_content content,
for (i = 0; i < content_size; i++)
{
struct tui_gen_win_info *generic_win
- = &content[i]->which_element.data_window;
+ = content[i]->which_element.data_window;
if (generic_win != NULL)
{
@@ -710,6 +711,7 @@ free_content_elements (tui_win_content content,
xfree (element->which_element.source.line);
break;
case DATA_WIN:
+ xfree (element->which_element.data_window);
xfree (element);
break;
case DATA_ITEM_WIN: