+2019-08-15 Tom Tromey <tom@tromey.com>
+
+ * tui/tui-winsource.h (tui_alloc_source_buffer): Don't declare.
+ (struct tui_source_element): Add DISABLE_COPY_AND_ASSIGN, and move
+ constructor.
+ * tui/tui-winsource.c (tui_alloc_source_buffer): Remove.
+ * tui/tui-source.c (tui_set_source_content): Update.
+ * tui/tui-disasm.c (tui_set_disassem_content): Update.
+
2019-08-15 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (tui_line_is_displayed): Don't declare.
if (pc == 0)
return TUI_FAILURE;
- tui_alloc_source_buffer (win_info);
-
win_info->gdbarch = gdbarch;
win_info->start_line_or_addr.loa = LOA_ADDRESS;
win_info->start_line_or_addr.u.addr = pc;
int line_width, nlines;
ret = TUI_SUCCESS;
- tui_alloc_source_buffer (win_info);
line_width = win_info->width - 1;
/* Take hilite (window border) into account, when
calculating the number of lines. */
}
execution_info->refresh_window ();
}
-
-
-void
-tui_alloc_source_buffer (struct tui_source_window_base *win_info)
-{
- int i, line_width, max_lines;
-
- /* The window width/height includes the highlight box. Determine actual
- content dimensions, including string null-terminators. */
- max_lines = win_info->height - 2;
- line_width = win_info->width - 2 + 1;
-
- /* Allocate the buffer for the source lines. */
- win_info->content.resize (max_lines);
- for (i = 0; i < max_lines; i++)
- {
- if (win_info->content[i].line == nullptr)
- win_info->content[i].line = (char *) xmalloc (line_width);
- }
-}
xfree (line);
}
+ DISABLE_COPY_AND_ASSIGN (tui_source_element);
+
+ tui_source_element (tui_source_element &&other)
+ : line (other.line),
+ line_or_addr (other.line_or_addr),
+ is_exec_point (other.is_exec_point),
+ break_mode (other.break_mode)
+ {
+ other.line = nullptr;
+ }
+
char *line = nullptr;
struct tui_line_or_address line_or_addr;
bool is_exec_point = false;
extern void tui_clear_source_content (struct tui_source_window_base *);
extern void tui_erase_source_content (struct tui_source_window_base *);
-extern void tui_alloc_source_buffer (struct tui_source_window_base *);
-
-
/* Constant definitions. */
#define SCROLL_THRESHOLD 2 /* Threshold for lazy scroll. */