From 716b8bc52eef6044f1ff361e3e2eeb9307849034 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 29 Apr 2018 23:12:05 -0600 Subject: 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 * 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. --- gdb/cli/cli-interp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'gdb/cli') diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c index 0663301..e12d45b 100644 --- a/gdb/cli/cli-interp.c +++ b/gdb/cli/cli-interp.c @@ -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 (interp); } /* Longjmp-safe wrapper for "execute_command". */ -- cgit v1.1