This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v3 01/14] introduce ui_file_write_for_put


From: Tom Tromey <tromey@redhat.com>

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.

2014-10-07  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   |    7 +++++++
 gdb/mi/mi-out.c |    8 +-------
 gdb/ui-file.c   |    6 ++++++
 gdb/ui-file.h   |    6 ++++++
 4 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a629660..9993a2b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2014-10-07  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-10-31  Doug Evans  <xdje42@gmail.com>
 
 	* objfiles.h (ALL_PSPACE_OBJFILES_SAFE): Delete, unused.
diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c
index 6ec41e6..9f5d1c0 100644
--- a/gdb/mi/mi-out.c
+++ b/gdb/mi/mi-out.c
@@ -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);
 }
 
diff --git a/gdb/ui-file.c b/gdb/ui-file.c
index 49607dc..e3c7ba2 100644
--- a/gdb/ui-file.c
+++ b/gdb/ui-file.c
@@ -223,6 +223,12 @@ ui_file_write (struct ui_file *file,
 }
 
 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,
 			  long length_buf)
diff --git a/gdb/ui-file.h b/gdb/ui-file.h
index 50c1333..29ce5e0 100644
--- a/gdb/ui-file.h
+++ b/gdb/ui-file.h
@@ -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);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]