mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-28 23:39:35 +08:00
Change the as_*_interp functions to use dynamic_cast
This changes the various as_*_interp functions to be implemented using dynamic_cast. I believe this is a small improvement, because it is more typesafe -- the C++ runtime does the type-checking for us. ChangeLog 2018-05-25 Tom Tromey <tom@tromey.com> * tui/tui-interp.c (as_tui_interp): Use dynamic_cast. * mi/mi-interp.c (as_mi_interp): Use dynamic_cast. * cli/cli-interp.c (as_cli_interp): Use dynamic_cast.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2018-05-25 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* tui/tui-interp.c (as_tui_interp): Use dynamic_cast.
|
||||||
|
* mi/mi-interp.c (as_mi_interp): Use dynamic_cast.
|
||||||
|
* cli/cli-interp.c (as_cli_interp): Use dynamic_cast.
|
||||||
|
|
||||||
2018-05-25 Tom Tromey <tom@tromey.com>
|
2018-05-25 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* cli/cli-interp.c (safe_execute_command): Use scoped_restore.
|
* cli/cli-interp.c (safe_execute_command): Use scoped_restore.
|
||||||
|
@ -73,9 +73,7 @@ struct cli_suppress_notification cli_suppress_notification =
|
|||||||
static struct cli_interp *
|
static struct cli_interp *
|
||||||
as_cli_interp (struct interp *interp)
|
as_cli_interp (struct interp *interp)
|
||||||
{
|
{
|
||||||
if (strcmp (interp_name (interp), INTERP_CONSOLE) == 0)
|
return dynamic_cast<cli_interp *> (interp);
|
||||||
return (struct cli_interp *) interp;
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Longjmp-safe wrapper for "execute_command". */
|
/* Longjmp-safe wrapper for "execute_command". */
|
||||||
|
@ -106,9 +106,7 @@ display_mi_prompt (struct mi_interp *mi)
|
|||||||
static struct mi_interp *
|
static struct mi_interp *
|
||||||
as_mi_interp (struct interp *interp)
|
as_mi_interp (struct interp *interp)
|
||||||
{
|
{
|
||||||
if (interp_ui_out (interp)->is_mi_like_p ())
|
return dynamic_cast<mi_interp *> (interp);
|
||||||
return (struct mi_interp *) interp;
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -58,9 +58,7 @@ public:
|
|||||||
static tui_interp *
|
static tui_interp *
|
||||||
as_tui_interp (struct interp *interp)
|
as_tui_interp (struct interp *interp)
|
||||||
{
|
{
|
||||||
if (strcmp (interp_name (interp), INTERP_TUI) == 0)
|
return dynamic_cast<tui_interp *> (interp);
|
||||||
return (tui_interp *) interp;
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cleanup the tui before exiting. */
|
/* Cleanup the tui before exiting. */
|
||||||
|
Reference in New Issue
Block a user