introduce ui_file_write_for_put
authorTom Tromey <tromey@redhat.com>
Fri, 12 Dec 2014 21:12:12 +0000 (22:12 +0100)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Fri, 12 Dec 2014 21:12:12 +0000 (22:12 +0100)
This introduces a small helper function, ui_file_write_for_put.  It is
a wrapper for ui_write that is suitable for passing directly to
ui_file_put.

This patch also updates one existing spot to use this new function.

gdb/ChangeLog
2014-12-12  Tom Tromey  <tromey@redhat.com>

* ui-file.h (ui_file_write_for_put): Declare.
* ui-file.c (ui_file_write_for_put): New function.
* mi/mi-out.c (do_write): Remove.
(mi_out_put): Use ui_file_write_for_put.

gdb/ChangeLog
gdb/mi/mi-out.c
gdb/ui-file.c
gdb/ui-file.h

index 70d46293ec94d5799ba2d3a69b9ddc47589fd62b..56ebab0f9bb87784594016e00241f1165ef8287e 100644 (file)
@@ -1,3 +1,10 @@
+2014-12-12  Tom Tromey  <tromey@redhat.com>
+
+       * ui-file.h (ui_file_write_for_put): Declare.
+       * ui-file.c (ui_file_write_for_put): New function.
+       * mi/mi-out.c (do_write): Remove.
+       (mi_out_put): Use ui_file_write_for_put.
+
 2014-12-12  Doug Evans  <dje@google.com>
 
        * NEWS: Mention gdb.lookup_objfile.
index 6ec41e6aab242b907320c097b058a2b85af96b92..9f5d1c0e77e60c7bbbdbfd7103683b25ebadc7ff 100644 (file)
@@ -376,18 +376,12 @@ mi_out_rewind (struct ui_out *uiout)
 
 /* Dump the buffer onto the specified stream.  */
 
-static void
-do_write (void *data, const char *buffer, long length_buffer)
-{
-  ui_file_write (data, buffer, length_buffer);
-}
-
 void
 mi_out_put (struct ui_out *uiout, struct ui_file *stream)
 {
   mi_out_data *data = ui_out_data (uiout);
 
-  ui_file_put (data->buffer, do_write, stream);
+  ui_file_put (data->buffer, ui_file_write_for_put, stream);
   ui_file_rewind (data->buffer);
 }
 
index 49607dcc1b41c1fa74ca9db4629a01632829e1db..e3c7ba2ab92ba564968202b4215ad53070c41774 100644 (file)
@@ -222,6 +222,12 @@ ui_file_write (struct ui_file *file,
   file->to_write (file, buf, length_buf);
 }
 
+void
+ui_file_write_for_put (void *data, const char *buffer, long length_buffer)
+{
+  ui_file_write (data, buffer, length_buffer);
+}
+
 void
 ui_file_write_async_safe (struct ui_file *file,
                          const char *buf,
index 50c1333458eadc2127fdab7fcc131cc041cd6b25..29ce5e0c961e66a9c51537fdedf16dac6a53cb09 100644 (file)
@@ -98,6 +98,12 @@ extern int ui_file_isatty (struct ui_file *);
 extern void ui_file_write (struct ui_file *file, const char *buf,
                           long length_buf);
 
+/* A wrapper for ui_file_write that is suitable for use by
+   ui_file_put.  */
+
+extern void ui_file_write_for_put (void *data, const char *buffer,
+                                  long length_buffer);
+
 extern void ui_file_write_async_safe (struct ui_file *file, const char *buf,
                                      long length_buf);