aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-file.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-08-11 14:03:55 -0600
committerTom Tromey <tromey@adacore.com>2022-08-31 11:03:40 -0600
commit90621f6922ec7da513a2af46234bb5ae11a663ae (patch)
tree3c2dc40592e47eb79809ae6a2fbf215f402195b8 /gdb/tui/tui-file.c
parentb8043d27217ff89abba733476cb71c3656f5722a (diff)
downloadgdb-90621f6922ec7da513a2af46234bb5ae11a663ae.zip
gdb-90621f6922ec7da513a2af46234bb5ae11a663ae.tar.gz
gdb-90621f6922ec7da513a2af46234bb5ae11a663ae.tar.bz2
TUI stdout buffering cleanup
The TUI checks against gdb_stdout to decide when to buffer. It seems much cleaner to me to simply record this as an attribute of the stream itself.
Diffstat (limited to 'gdb/tui/tui-file.c')
-rw-r--r--gdb/tui/tui-file.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/gdb/tui/tui-file.c b/gdb/tui/tui-file.c
index 49dafce..3cf3dbc 100644
--- a/gdb/tui/tui-file.c
+++ b/gdb/tui/tui-file.c
@@ -22,24 +22,11 @@
#include "tui/tui-command.h"
#include "tui.h"
-tui_file::tui_file (FILE *stream)
- : stdio_file (stream)
-{}
-
-/* All TUI I/O sent to the *_filtered and *_unfiltered functions
- eventually ends up here. The fputs_unfiltered_hook is primarily
- used by GUIs to collect all output and send it to the GUI, instead
- of the controlling terminal. Only output to gdb_stdout and
- gdb_stderr are sent to the hook. Everything else is sent on to
- fputs to allow file I/O to be handled appropriately. */
-
void
tui_file::puts (const char *linebuffer)
{
tui_puts (linebuffer);
- /* gdb_stdout is buffered, and the caller must gdb_flush it at
- appropriate times. Other streams are not so buffered. */
- if (this != gdb_stdout)
+ if (!m_buffered)
tui_refresh_cmd_win ();
}
@@ -47,18 +34,14 @@ void
tui_file::write (const char *buf, long length_buf)
{
tui_write (buf, length_buf);
- /* gdb_stdout is buffered, and the caller must gdb_flush it at
- appropriate times. Other streams are not so buffered. */
- if (this != gdb_stdout)
+ if (!m_buffered)
tui_refresh_cmd_win ();
}
void
tui_file::flush ()
{
- /* gdb_stdout is buffered. Other files are always flushed on
- every write. */
- if (this == gdb_stdout)
+ if (m_buffered)
tui_refresh_cmd_win ();
stdio_file::flush ();
}