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:
parent
753ff9bd83
commit
716b8bc52e
4 changed files with 9 additions and 9 deletions
|
@ -73,9 +73,7 @@ struct cli_suppress_notification cli_suppress_notification =
|
|||
static struct cli_interp *
|
||||
as_cli_interp (struct interp *interp)
|
||||
{
|
||||
if (strcmp (interp_name (interp), INTERP_CONSOLE) == 0)
|
||||
return (struct cli_interp *) interp;
|
||||
return NULL;
|
||||
return dynamic_cast<cli_interp *> (interp);
|
||||
}
|
||||
|
||||
/* Longjmp-safe wrapper for "execute_command". */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue