aboutsummaryrefslogtreecommitdiff
path: root/gdb/interps.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/interps.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/interps.c')
-rw-r--r--gdb/interps.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/gdb/interps.c b/gdb/interps.c
index 0c440e7..3a9c590 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -168,15 +168,8 @@ interp_set (struct interp *interp, bool top_level)
if (top_level)
ui_interp->top_level_interpreter = interp;
- /* We use interpreter_p for the "set interpreter" variable, so we need
- to make sure we have a malloc'ed copy for the set command to free. */
- if (interpreter_p != NULL
- && strcmp (interp->name (), interpreter_p) != 0)
- {
- xfree (interpreter_p);
-
- interpreter_p = xstrdup (interp->name ());
- }
+ if (interpreter_p != interp->name ())
+ interpreter_p = interp->name ();
/* Run the init proc. */
if (!interp->inited)