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.
This commit is contained in:
Tom Tromey
2022-06-17 10:01:45 -06:00
parent ee04bfc01e
commit b2a696a881
4 changed files with 15 additions and 31 deletions

View File

@@ -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)