Add stream to buffer_group::output_unit constructor
I noticed that when creating a new output_unit, all the calls looked
like:
m_buffered_output.emplace_back ("", indent).m_stream = stream;
It seems better to simply pass the stream to the constructor.
Approved-By: Andrew Burgess <aburgess@redhat.com>
diff --git a/gdb/buffered-streams.c b/gdb/buffered-streams.c
index a9d3fcf..71122c7 100644
--- a/gdb/buffered-streams.c
+++ b/gdb/buffered-streams.c
@@ -51,7 +51,7 @@ buffer_group::write (const char *buf, long length_buf, ui_file *stream)
&& m_buffered_output.back ().m_msg.back () != '\n')
m_buffered_output.back ().m_msg.append (msg);
else
- m_buffered_output.emplace_back (msg).m_stream = stream;
+ m_buffered_output.emplace_back (stream, msg);
prev = cur + 1;
}
}
@@ -61,7 +61,7 @@ buffer_group::write (const char *buf, long length_buf, ui_file *stream)
void
buffer_group::wrap_here (int indent, ui_file *stream)
{
- m_buffered_output.emplace_back ("", indent).m_stream = stream;
+ m_buffered_output.emplace_back (stream, "", indent);
}
/* See buffered-streams.h. */
@@ -69,7 +69,7 @@ buffer_group::wrap_here (int indent, ui_file *stream)
void
buffer_group::flush_here (ui_file *stream)
{
- m_buffered_output.emplace_back ("", -1, true).m_stream = stream;
+ m_buffered_output.emplace_back (stream, "", -1, true);
}
/* See buffered-streams.h. */
diff --git a/gdb/buffered-streams.h b/gdb/buffered-streams.h
index 0da2d8a..9da45b0 100644
--- a/gdb/buffered-streams.h
+++ b/gdb/buffered-streams.h
@@ -48,8 +48,10 @@ struct buffer_group
struct output_unit
{
- output_unit (std::string msg, int wrap_hint = -1, bool flush = false)
- : m_msg (msg), m_wrap_hint (wrap_hint), m_flush (flush)
+ output_unit (ui_file *stream, std::string msg, int wrap_hint = -1,
+ bool flush = false)
+ : m_stream (stream), m_msg (msg), m_wrap_hint (wrap_hint),
+ m_flush (flush)
{}
/* Write contents of this output_unit to the underlying stream. */