diff options
author | Tom Tromey <tom@tromey.com> | 2019-10-21 10:58:08 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-11-05 15:23:36 -0700 |
commit | 5d0510553eb447bf6861f4641b5ae3aaf9503a13 (patch) | |
tree | e5e9abf7cc0fdc983ac6dbcc32c8659a712b17b2 /gdb/tui/tui-disasm.c | |
parent | ade7beeae467e81b809fc124d8bfc2f3c4a8c8ab (diff) | |
download | gdb-5d0510553eb447bf6861f4641b5ae3aaf9503a13.zip gdb-5d0510553eb447bf6861f4641b5ae3aaf9503a13.tar.gz gdb-5d0510553eb447bf6861f4641b5ae3aaf9503a13.tar.bz2 |
Change tui_source_element::line to have type std::string
This changes tui_source_element::line to be of type std::string. This
reduces the number of copies made.
gdb/ChangeLog
2019-11-05 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (struct tui_source_element) <line>: Now a
std::string.
* tui/tui-winsource.c (tui_show_source_line): Update.
* tui/tui-source.c (tui_source_window::set_contents): Update.
* tui/tui-disasm.c (tui_disasm_window::set_contents): Update.
Change-Id: Id600f3e1d386a2911f187366e05e2ec599068dd2
Diffstat (limited to 'gdb/tui/tui-disasm.c')
-rw-r--r-- | gdb/tui/tui-disasm.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index 33a3ba1..91c9845 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -216,10 +216,10 @@ tui_disasm_window::set_contents (struct gdbarch *arch, + asm_lines[i].insn); /* Now copy the line taking the offset into account. */ - if (line.size() > offset) - src->line.reset (xstrndup (&line[offset], line_width)); + if (line.size () > offset) + src->line = line.substr (offset, line_width); else - src->line = make_unique_xstrdup (""); + src->line.clear (); src->line_or_addr.loa = LOA_ADDRESS; src->line_or_addr.u.addr = asm_lines[i].addr; |