aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-interp.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-06-17 10:01:45 -0600
committerTom Tromey <tromey@adacore.com>2022-06-22 13:28:55 -0600
commitb2a696a8810f2ec36765c9bdcb56e62737376caf (patch)
tree361a670c4689d248a8ef04c0c61417f969c54cb3 /gdb/tui/tui-interp.c
parentee04bfc01e51faae3fb64f6582f0e207d3ad898d (diff)
downloadgdb-b2a696a8810f2ec36765c9bdcb56e62737376caf.zip
gdb-b2a696a8810f2ec36765c9bdcb56e62737376caf.tar.gz
gdb-b2a696a8810f2ec36765c9bdcb56e62737376caf.tar.bz2
Use std::string for interpreter_p
The global interpreter_p is a manually-managed 'char *'. This patch changes it to be a std::string instead, and removes some erroneous comments.
Diffstat (limited to 'gdb/tui/tui-interp.c')
-rw-r--r--gdb/tui/tui-interp.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c
index e867441..b4faede 100644
--- a/gdb/tui/tui-interp.c
+++ b/gdb/tui/tui-interp.c
@@ -343,14 +343,11 @@ _initialize_tui_interp ()
{
interp_factory_register (INTERP_TUI, tui_interp_factory);
- if (interpreter_p && strcmp (interpreter_p, INTERP_TUI) == 0)
+ if (interpreter_p == INTERP_TUI)
tui_start_enabled = true;
- if (interpreter_p && strcmp (interpreter_p, INTERP_CONSOLE) == 0)
- {
- xfree (interpreter_p);
- interpreter_p = xstrdup (INTERP_TUI);
- }
+ if (interpreter_p == INTERP_CONSOLE)
+ interpreter_p = INTERP_TUI;
/* If changing this, remember to update cli-interp.c as well. */
gdb::observers::normal_stop.attach (tui_on_normal_stop, "tui-interp");