Remove interp_name
authorTom Tromey <tom@tromey.com>
Mon, 30 Apr 2018 05:12:07 +0000 (23:12 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 25 May 2018 18:41:01 +0000 (12:41 -0600)
This removes the interp_name function.  It is only used a few spots --
one of which was only calling it on "this".  It's simpler to remove
it; and should class interp become opaque in the future, it will be
just as easy to update the two remaining spots to use an accessor.

ChangeLog
2018-05-25  Tom Tromey <tom@tromey.com>

* interps.c (interp_name): Remove.
* mi/mi-interp.c (mi_interp::init): Update.
* interps.h (interp_name): Remove.
(~scoped_restore_interp): Update.
* tui/tui.c (tui_enable): Update.

gdb/ChangeLog
gdb/interps.c
gdb/interps.h
gdb/mi/mi-interp.c
gdb/tui/tui.c

index 5cd551a4ef15f7ad7edc7c21c0270fbae0a5ae84..0bf350c2554658b7ad3db179269416babe467a04 100644 (file)
@@ -1,3 +1,11 @@
+2018-05-25  Tom Tromey <tom@tromey.com>
+
+       * interps.c (interp_name): Remove.
+       * mi/mi-interp.c (mi_interp::init): Update.
+       * interps.h (interp_name): Remove.
+       (~scoped_restore_interp): Update.
+       * tui/tui.c (tui_enable): Update.
+
 2018-05-25  Tom Tromey <tom@tromey.com>
 
        * utils.c (fputs_maybe_filtered): Update.
index 58846258563dea7d093d3b4d2e09916c3c46121b..8ec9744fdfe5e7d2c4e0d88bb43df1a6876c25f3 100644 (file)
@@ -274,14 +274,6 @@ scoped_restore_interp::set_interp (const char *name)
   return old_interp;
 }
 
-/* Returns the interpreter's name.  */
-
-const char *
-interp_name (struct interp *interp)
-{
-  return interp->name;
-}
-
 /* Returns true if the current interp is the passed in name.  */
 int
 current_interp_named_p (const char *interp_name)
index 694149a6ca1001acfe0d07478a54189246573e15..a689be56253d361c66153879df2bfdebf6345032 100644 (file)
@@ -98,8 +98,6 @@ extern struct interp *interp_lookup (struct ui *ui, const char *name);
    interpreter fails to initialize.  */
 extern void set_top_level_interpreter (const char *name);
 
-extern const char *interp_name (struct interp *interp);
-
 /* Temporarily set the current interpreter, and reset it on
    destruction.  */
 class scoped_restore_interp
@@ -113,7 +111,7 @@ public:
 
   ~scoped_restore_interp ()
   {
-    set_interp (interp_name (m_interp));
+    set_interp (m_interp->name);
   }
 
   scoped_restore_interp (const scoped_restore_interp &) = delete;
index 99ce1eb5d64efe394e0437cb93c361afb83574b0..e52d7979738830b78c1b5ca40c557c95242f84a6 100644 (file)
@@ -113,7 +113,6 @@ void
 mi_interp::init (bool top_level)
 {
   mi_interp *mi = this;
-  const char *name;
   int mi_version;
 
   /* Store the current output channel, so that we can create a console
@@ -129,7 +128,6 @@ mi_interp::init (bool top_level)
   mi->targ = new mi_console_file (mi->raw_stdout, "@", '"');
   mi->event_channel = new mi_console_file (mi->raw_stdout, "=", 0);
 
-  name = interp_name (this);
   /* INTERP_MI selects the most recent released version.  "mi2" was
      released as part of GDB 6.0.  */
   if (strcmp (name, INTERP_MI) == 0)
index 7943a61676927a7230545f0440593688489d5356..9e2520b4fc6ee4289e65f15af3e385dba5ce1ead 100644 (file)
@@ -415,7 +415,7 @@ tui_enable (void)
 
       /* If the top level interpreter is not the console/tui (e.g.,
         MI), enabling curses will certainly lose.  */
-      interp = interp_name (top_level_interpreter ());
+      interp = top_level_interpreter ()->name;
       if (strcmp (interp, INTERP_TUI) != 0)
        error (_("Cannot enable the TUI when the interpreter is '%s'"), interp);
 
This page took 0.031632 seconds and 4 git commands to generate.