[16/23] Introduce display_mi_prompt

Message ID 1454517838-7784-17-git-send-email-palves@redhat.com
State New, archived
Headers

Commit Message

Pedro Alves Feb. 3, 2016, 4:43 p.m. UTC
  Just a refactor.
---
 gdb/mi/mi-interp.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
  

Patch

diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index d6b1aa4..e3ee939 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -88,6 +88,13 @@  static void mi_on_sync_execution_done (void);
 
 static int report_initial_inferior (struct inferior *inf, void *closure);
 
+static void
+display_mi_prompt (void)
+{
+  fputs_unfiltered ("(gdb) \n", raw_stdout);
+  gdb_flush (raw_stdout);
+}
+
 static struct mi_interp *
 as_mi_interp (struct interp *interp)
 {
@@ -296,10 +303,7 @@  mi_on_sync_execution_done (void)
   /* If MI is sync, then output the MI prompt now, indicating we're
      ready for further input.  */
   if (!mi_async_p ())
-    {
-      fputs_unfiltered ("(gdb) \n", raw_stdout);
-      gdb_flush (raw_stdout);
-    }
+    display_mi_prompt ();
 }
 
 /* mi_execute_command_wrapper wrapper suitable for INPUT_HANDLER.  */
@@ -315,10 +319,7 @@  mi_execute_command_input_handler (char *cmd)
      'synchronous_command_done' observer when the target next
      stops.  */
   if (!sync_execution)
-    {
-      fputs_unfiltered ("(gdb) \n", raw_stdout);
-      gdb_flush (raw_stdout);
-    }
+    display_mi_prompt ();
 }
 
 static void
@@ -329,8 +330,7 @@  mi_command_loop (void *data)
   sevenbit_strings = 1;
 
   /* Tell the world that we're alive.  */
-  fputs_unfiltered ("(gdb) \n", raw_stdout);
-  gdb_flush (raw_stdout);
+  display_mi_prompt ();
 
   start_event_loop ();
 }