[binutils-gdb] Add wrapped_file::write
Tom Tromey via Gdb-cvs <[email protected]>
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a7faf09929ce1dcfaaea54655b06b205410ae060 commit a7faf09929ce1dcfaaea54655b06b205410ae060 Author: Tom Tromey <[email protected]> Date: Wed Jan 14 10:51:44 2026 -0700 Add wrapped_file::write This adds an implementation of wrapped_file::write. With this change, a wrapped_file can be used as-is, without requiring a subclass. This is convenient for a subsequent patch. An existing subclass is simplified due to this change. Diff: --- gdb/ui-file.h | 13 ++++++++----- gdb/ui.h | 5 ----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/gdb/ui-file.h b/gdb/ui-file.h index d5771635468..6da4eb7a231 100644 --- a/gdb/ui-file.h +++ b/gdb/ui-file.h @@ -396,6 +396,11 @@ class wrapped_file : public ui_file { public: + explicit wrapped_file (T stream) + : m_stream (std::move (stream)) + { + } + bool isatty () override { return m_stream->isatty (); } @@ -420,6 +425,9 @@ public: void puts_unfiltered (const char *str) override { m_stream->puts_unfiltered (str); } + void write (const char *buf, long length_buf) override + { return m_stream->write (buf, length_buf); } + void write_async_safe (const char *buf, long length_buf) override { return m_stream->write_async_safe (buf, length_buf); } @@ -430,11 +438,6 @@ public: protected: - explicit wrapped_file (T stream) - : m_stream (std::move (stream)) - { - } - /* The underlying stream. */ T m_stream; }; diff --git a/gdb/ui.h b/gdb/ui.h index c2b1bca2121..891660896ef 100644 --- a/gdb/ui.h +++ b/gdb/ui.h @@ -173,11 +173,6 @@ struct ui passthrough_file () : wrapped_file<ui_file_ptr<F>> ({}) { } - - void write (const char *buf, long len) override - { - this->m_stream->write (buf, len); - } }; /* The fields below that start with "m_" are "private". They're